python - Using SubProcess with shell=false -


i have piece of python needs open file in osx, via default application, selected inside tkinter file open control. not know file type when selected nor default app.

tk().withdraw() filename = askopenfilename()  child = subprocess.check_call("open" ,filename) 

my problem not work...if include shell=true need capture pid of application started not pid of shell executed command.

any thoughts?

thanks c

if shell keyword argument false input must sequence. you're passing filename second argument, instead of first.

child = subprocess.check_call(["open", filename]) 

to quote docs:

the shell argument (which defaults false) specifies whether use shell program execute. if shell true, recommended pass args string rather sequence.


Comments

Popular posts from this blog

c++ - End of file on pipe magic during open -

basic authentication with http post params android -

data.table making a copy of table in R -