Author chris.jerdonek
Recipients asvetlov, chris.jerdonek
Date 2012-10-03.04:16:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1349237807.22.0.592724343556.issue16114@psf.upfronthosting.co.za>
In-reply-to
Content
The error message in the FileNotFoundError error raised by subprocess.Popen() displays the wrong path when the bad path is due to the executable argument rather than args.  The message gives the path for args[0] rather than for the executable argument.

For example, this--

import subprocess, sys
python_path = sys.executable
p = subprocess.Popen([python_path, "-c", "import sys; sys.exit(1)"])
p.wait()
p = subprocess.Popen([python_path, "-c", "import sys; sys.exit(1)"],
                     executable="foo")
p.wait()

gives--

Traceback (most recent call last):
  File "test-subprocess.py", line 6, in <module>
    executable="foo")
  File ".../Lib/subprocess.py", line 818, in __init__
    restore_signals, start_new_session)
  File ".../Lib/subprocess.py", line 1416, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '.../python.exe'

The path in the last line should read "foo" since '.../python.exe' is obviously found as evidenced from the previous Popen() invocation.
History
Date User Action Args
2012-10-03 04:16:47chris.jerdoneksetrecipients: + chris.jerdonek, asvetlov
2012-10-03 04:16:47chris.jerdoneksetmessageid: <1349237807.22.0.592724343556.issue16114@psf.upfronthosting.co.za>
2012-10-03 04:16:47chris.jerdoneklinkissue16114 messages
2012-10-03 04:16:46chris.jerdonekcreate