[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Gregory P. Smith added the comment: I backported the fix to this in the subprocess32 3.2.5rc1 release I made a week or two ago. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Gregory P. Smith added the comment: fyi - I agree with your comments about the test and assertRaises. This code is old, there's a lot that could be improved in there. I chose to maintain a style equivalent to the existing surrounding code. Feel free to clean that up. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Gregory P. Smith added the comment: replacing repr(args[0]) with repr(executable) in the identified python should be sufficient for this bug as originally reported. BUT it goes deeper: I just ran into this error in a different case. It also happens when cwd is passed and the chdir(cwd) fails in the child process. args[0] is reported as not found rather than cwd in the error message. I have a test and fix for that. I'll take care of both. -- assignee: chris.jerdonek - gregory.p.smith nosy: +gregory.p.smith ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: replacing repr(args[0]) with repr(executable) in the identified python should be sufficient for this bug as originally reported. Yes, almost. The executable variable is a bytes object so it needs to be fsdecoded first. I have a test and fix for that. I'll take care of both. Let me at least upload what I already prepared. You can add to it or modify it as you see fit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Roundup Robot added the comment: New changeset e938fa6be509 by Gregory P. Smith in branch '3.2': Fixes Issue #16114: The subprocess module no longer provides a http://hg.python.org/cpython/rev/e938fa6be509 New changeset ee30d7ef70be by Gregory P. Smith in branch '3.3': Fixes Issue #16114: The subprocess module no longer provides a http://hg.python.org/cpython/rev/ee30d7ef70be -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Roundup Robot added the comment: New changeset 543bb0e0afb9 by Gregory P. Smith in branch 'default': Fixes Issue #16114: The subprocess module no longer provides a http://hg.python.org/cpython/rev/543bb0e0afb9 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Gregory P. Smith added the comment: I'm keeping this open until I backport this to subprocess32 for use on Python 2. -- stage: needs patch - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: I made some comments on the changes as committed here: http://mail.python.org/pipermail/python-dev/2012-October/122125.html It would be cleaner to use the self.assertRaises() pattern here and also probably better to share code across the three test methods which are nearly identical to one another (there is a fourth scenario I would also add of shell=True). I would also check for FileNotFoundError instead of OSError in the 3.3 and later versions. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: Maybe better to fix Windows behavior for unifying FileNotFoundError? I created issue 16185 to include the path in the messages of the corresponding errors on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: BTW, the patch fails for 3.2 and 3.3 but works for 3.4 By patch do you mean test? And by works, do you mean fails or succeeds? :) I haven't prepared a patch yet, but I just started working on it. On my machine, I found that the test fails as is on 3.3 and 3.4, but on 3.2 it fails for a different reason: the FileNotFoundError needs to be switched to OSError (which was to be expected). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- assignee: - chris.jerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Andrew Svetlov added the comment: Maybe better to fix Windows behavior for unifying FileNotFoundError? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: I will be opening a separate issue to have the same behavior in a future version after this issue is closed. For existing releases, we don't want to break working code that could be relying on the difference. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: Sorry, I was confusing this issue with issue 15533. Yes, I support adding the file path to the error message in the Windows implementation, though my preference would be for that to be addressed as part of a separate issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Andrew Svetlov added the comment: I'm ok with your patch if it will be applied to 3.2 etc and after that new issue will fix Windows problem. BTW, the patch fails for 3.2 and 3.3 but works for 3.4 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: Adding issue 16115 as a dependency so that the more general case can be settled and committed before dealing with the current issue's more specific (and platform-specific) case. -- dependencies: +test that executable arg to Popen() takes precedence over args[0] arg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: Attaching proposed tests. -- keywords: +patch stage: test needed - needs patch Added file: http://bugs.python.org/file27396/issue-16114-1-tests-default.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
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 rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: 2.7 is not affected because 2.7 makes no attempt to display the path: OSError: [Errno 2] No such file or directory -- versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message
Chris Jerdonek added the comment: It looks like the error is here: if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) if errno_num != 0: err_msg = os.strerror(errno_num) if errno_num == errno.ENOENT: err_msg += ': ' + repr(args[0]) raise child_exception_type(errno_num, err_msg) raise child_exception_type(err_msg) http://hg.python.org/cpython/file/b40025e37bcd/Lib/subprocess.py#l1415 The args[0] should be executable when appropriate. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com