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

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -