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

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

jepler at 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:

More information about the Python-list mailing list