[python-win32] Calling a subprocess with spaces in the path
Metz, Bobby W, WWCS
bwmetz at att.com
Thu Oct 19 03:11:14 CEST 2006
Google "subprocess Popen parameters" or "subprocess Popen arguments"...the first few hits should explain.
B
-----Original Message-----
From: python-win32-bounces+bwmetz=att.com at python.org [mailto:python-win32-bounces+bwmetz=att.com at python.org] On Behalf Of Gabriel Genellina
Sent: Wednesday, October 18, 2006 3:02 PM
To: Axiom X11
Cc: python-win32 at python.org
Subject: Re: [python-win32] Calling a subprocess with spaces in the path
At Wednesday 18/10/2006 17:43, Axiom X11 wrote:
>I am trying to run a command as a subprocess, and it keeps choking
>on the spaces.
>
>
>import subprocess
>
>
>s = 'vlc "C:\\Documents and
>Settings\\bk\\Documents\\Resources\\WORKINPR2001.mpeg"
>:sout=\#duplicate{dst=display,dst=std{access=udp,mux=ts,dst=<http://224.0.0.0:1234>224.0.0.0:1234
>}}
>:sout=#duplicate{dst=display,dst=std{access=udp,mux=ts,dst=<http://224.0.0.0:1234>224.0.0.0:1234}}'
>print s
>process = subprocess.Popen([s], shell=True)
Try omitting the shell=True argument.
>Is there something I am missing about spaces in the path on windows?
Yes, type cmd /? and see the rather crazy rules about quotes on the shell...
>(BTW if I use
>
>f=os.popen(s, 'w')
>
>It works fine, but that leaves me with a blocking call, and I really
>want a subprocess)
This way you are not running your comand thru the shell.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-win32
mailing list