[New-bugs-announce] [issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

Chris Jerdonek report at bugs.python.org
Wed Oct 3 06:16:47 CEST 2012


New submission from Chris Jerdonek:

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.

----------
components: Library (Lib)
messages: 171850
nosy: asvetlov, chris.jerdonek
priority: normal
severity: normal
stage: test needed
status: open
title: incorrect path in subprocess.Popen() FileNotFoundError message
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16114>
_______________________________________


More information about the New-bugs-announce mailing list