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

Peter Hansen peter at engcorp.com
Sat Dec 3 23:31:52 EST 2005


jepler at unpythonic.net wrote:
> This comes up from time to time.  The brain damage is all Windows', not
> Python's. Here's one thread which seems to suggest a bizarre doubling
> of the initial quote of the commandline.
> 
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/89d94656ea393d5b/ef40a65017848671

It can't all be Windows' brain damage, since typing precisely the same 
command at the prompt (at least with the example I'm using) doesn't 
require doubling the initial quote of the command line.  Or, more 
precisely, Windows is brain damaged in at least two different places 
here, and the shell is only one of them...

Also it appears the issue may be more the fact that the second argument 
*also* has quotation marks (regardless of whether it has a space in it 
or not).  It's only then (it seems) that the silly double initial 
quotation mark is required.  Either way, "brain damage" definitely 
describes it.

-Peter




More information about the Python-list mailing list