Spaces in path name

Tim Golden mail at timgolden.me.uk
Sun Mar 16 10:54:16 EDT 2008


Tim Golden wrote:
> What I haven't investigated yet is whether the additional flags
> your example is passing (shell=True etc.) cause the main Popen
> mechanism to take a different path.

Sure enough, passing shell=True -- which is probably quite
a rare requirement -- causes the code to change the call
from "a.exe b.doc" to '%COMSPEC% /c "a.exe" "b.doc"'.
The quoting rules (from cmd /?) are slightly involved but
I can't see at first why this shouldn't work. However it
clearly doesn't so I'll try to put together either a patch
to the subprocess code or to the docs warning of the behaviour.

I think that, in general, you need to pass shell=True far less
often that you might imagine. (Possibly only for internal
commands like dir, copy etc.).

TJG



More information about the Python-list mailing list