Spaces in path name

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


joep wrote:
> I assume that there is some difference how subprocess.call and
> subprocess.Popen handle and format the command. subprocess.Popen does
> the correct formatting when only one file path has spaces and requires
> double quoting, but not if there are two file paths with spaces in it.

The briefest of code explorations shows that subprocess.call simply
hands straight off to Popen, passing args & kwargs along verbatim,
and then calls .wait on the result. ie, this:

   subprocess.call (['a.exe', 'b.doc'])

simply becomes:

   subprocess.Popen (['a.exe', 'b.doc']).wait ()

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. I'll spend some time on
that this pm, unless someone gets in first with more of a clue
than I currently have.

TJG



More information about the Python-list mailing list