[python-win32] Calling a subprocess with spaces in the path

Gabriel Genellina gagsl-p32 at yahoo.com.ar
Thu Oct 19 00:01:43 CEST 2006


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