[Python-Dev] subprocess insufficiently platform-independent?

Fredrik Lundh fredrik at pythonware.com
Wed Aug 27 19:34:14 CEST 2008


Guido van Rossum wrote:

>> I can't reproduce this as described.
> 
> Which Windows version? This sounds like one of those things that could
> well vary by Windows version; if it works for you in Vista it may well
> be broken in XP. It could also vary by other setup parameters besides
> PATHEXT.

It works the same way on XP, at least:

 >>> import subprocess
 >>> cmd = ['svn', 'ls', '.']
 >>> subprocess.call(cmd, shell=False)
svn: '.' is not a working copy
1

According to the MS docs, CreateProcess works the same way on at least 
2K, XP and Vista.  The documentation is a bit vague (as usual), but it 
contains an example that implies that CreateProcess always adds ".exe" 
if not already there, and that you need to use the command interpreter 
(that is, shell=True) if you want to run something that's not a Windows 
executable module (e.g. a batch file).

</F>



More information about the Python-Dev mailing list