terminal - python - open file in application -
i using terminal sucsessfully open file in quicktime player 7, can't seem working using python same thing. working terminal:
open -a "quicktime player 7" /users/me/movies/test.mov
but not working in python 2.7, opens quicktime, not file:
command = ('open -a "quicktime player 7"', 'users/me/movies/test.mov') subprocess.popen(command, shell=true)
what doing wrong?
if pass command
list
/tuple
, have split arguments correctly:
command = ('open', '-a', 'quicktime player 7', '/users/me/movies/test.mov') subprocess.popen(command, shell=true)
then think should able drop shell=true
parameter. further, subprocess.call()
or subprocess.check_call()
(the former returns return value of program, latter raises exception if return value indicates error):
subprocess.check_call(['open', '-a', 'quicktime player 7', '/users/me/movies/test.mov'])
nb: coding-style-wise, command
passed list, seen in docs linked above.
edit: add '/'
@ beginning of both paths make work.
Comments
Post a Comment