How to execute an EXE via os.system() with spaces in the directory name?

Leif K-Brooks eurleif at ecritters.biz
Sun Dec 4 10:43:57 CET 2005


jepler at unpythonic.net wrote:
> This comes up from time to time.  The brain damage is all Windows', 
> not Python's.

It's perfectly reasonable behavior, and it also applies to Linux. The
shell uses spaces to separate arguments; how do you expect it to know
that you want a space to be part of the program's name unless you escape it?

> Here's one thread which seems to suggest a bizarre doubling of the 
> initial quote of the commandline.

A better solution would be to use subprocess:
<http://python.org/doc/current/lib/module-subprocess.html>.



More information about the Python-list mailing list