[Python-Dev] subprocess insufficiently platform-independent?

Barry Warsaw barry at python.org
Mon Aug 25 19:30:58 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Aug 25, 2008, at 1:13 PM, Guido van Rossum wrote:

> Several people at Google seem to have independently discovered that
> despite all of the platform-independent goodness in subprocess.py, you
> still need to be platform aware. One of my colleagues summarized it
> like this:
>
> """
> Given a straightforward command list like:
>
>    cmd = ['svn', 'ls', 'http://rietveld.googlecode.com/svn/trunk']
>
> You apparently cannot pass this list to any subprocess function
> (subprocess.call() or otherwise) with a set of arguments that allow it
> to "just work" on both Windows and non-Windows systems.

Unless I'm misremembering (I no longer have access to Windows), I  
believe that if you use ' '.join(cmd) as the first argument, it will  
work cross-platform.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSLLsU3EjvBPtnXfVAQJapQP+N4HY0I/uczbdQKB1bi6OV0BZgj5JS8an
Tz4FEnaD9LDegTnV8fqAx5/blIidZEdPjVkdmW4m4bz8tRNIEdoZyghHUmKycgRj
d65FU0e1tL40u0AoKl3ARO6WWkKKhaqn4R17065lh+V1ZNKutu2btiAso6VfWVW5
V7hvo/61ACM=
=P0Nb
-----END PGP SIGNATURE-----


More information about the Python-Dev mailing list