subprocess call in python -


i need execute following command in terminal multiple files setfile -c "" -t "" <filename> created python script take filenames arguments , use call function execute command. don't know how put "" marks in call pipe. here code

from subprocess import call import sys # sys.argv def main():     l = len(sys.argv)     l = l - 1     if(l>0):         in range(l):             termexecute(sys.argv[i])  def termexecute(argument):     call(["setfile", "-c ","","-t ","","argument"])  if __name__ == '__main__':     main() 

i pretty sure call(["setfile", "-c ","","-t ","","argument"]) wrong hope know right way of writing it.

edit:

akuls-macbook-pro:~ akulsanthosh$ python3 /users/akulsanthosh/documents/simple/setfile.py /volumes/akul/stuff/1.jpg /volumes/akul/stuff/2.jpg /volumes/akul/stuff/3.jpg  invalid type or creator value: '""' invalid type or creator value: '""' error: file not found. (-43)  on file: argument  invalid type or creator value: '""' invalid type or creator value: '""' error: file not found. (-43)  on file: argument  invalid type or creator value: '""' invalid type or creator value: '""' error: file not found. (-43)  on file: argument 

call(["setfile", "-c ",'""',"-t ",'""',"argument"])

python treats both ' & " valid string delimiters, possible. otherwise can escape quotes. in fact you've used string ' delimits '__main__' in code.

after looking @ errors you're getting try below
call(["setfile", "argument"])


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -