[Tutor] missing first argument on subprocess.Popen w/ executable

Lie Ryan lie.1296 at gmail.com
Fri May 29 11:07:16 CEST 2009

I'm wondering whether I have misunderstood the documentation or this is
a bug in either the documentation or the python:

Python 2.5.4 (r254:67916, May 18 2009, 20:53:31)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.Popen(['a', 'b', 'c', 'd'], executable='echo')
<subprocess.Popen object at 0x7fdf7bb2bd50>
b c d

shouldn't the output be
a b c d

where has the first argument (a) gone to?

Normally the first argument in arg is the executable name, however we
may also specify it as executable argument instead; but what's the
rationale for zapping the first argument when executable is present?

I want to use executable argument because the argument list will be
dynamically generated (list of filenames) and having to prepend the
executable to the list is ugly if you're using comprehension.

Or is it because I'm using a (rather) old version of python (the default
python from Gentoo amd64)

More information about the Tutor mailing list