A.T.Hofkamp wrote: > Lie Ryan wrote: >> 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? > > Under Unix, it is the displayed executable name eg in 'ps': > >>>> import subprocess >>>> subprocess.Popen(['60', '60'], executable='/bin/sleep') > <subprocess.Popen object at 0xb7ee0e6c> > > > While it is running, 'ps' lists > > USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND > user 26056 0.1 0.0 8140 3480 pts/11 S+ 11:13 0:00 python > user 26059 0.0 0.0 5796 560 pts/11 S+ 11:14 0:00 60 60
Now THAT is bizarre. Any word on Windows? >> 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? > > It is still the name of the executable, the value is just not used for > searching the program, rather just displayed. > >> Or is it because I'm using a (rather) old version of python (the default >> python from Gentoo amd64) > > Nope, it is feature of the OS. No way around it unless you patch the > kernel. If it's indeed a feature, shouldn't it be mentioned in the documentation (or at least a warning for unsuspecting user)? Or even better, shouldn't a separate argument (e.g. displayed_executable_name) be used? Either way, I'll try to put this to the bug tracker... _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor