problem with os.system calls under win32

Gordon McMillan gmcm at hypernet.com
Fri Apr 14 12:39:22 EDT 2000


william_93402 at my-deja.com wrote:

> I am attempting to do a system call in a directory with spaces in the
> name. For example:
> 
> >>>import os
> >>>os.system('c:\\f o o\\bar.exe')
> 1
> 
> when I place the executable in a dir such as c:\\foo I can successfully
> execute the system call. Is there something special I have to do when
> directory names contain spaces? Just for notes I am running by example
> in build 125 of pythonwin.

Follow MS's rules:
os.system('"c:\\f o o\\bar.exe"')

(must be double-quotes).

- Gordon




More information about the Python-list mailing list