classification
Title: subprocess: duplicate filename in exception message
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, benjamin.peterson, jwilk, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-01-03 21:34 by jwilk, last changed 2018-09-16 14:26 by ZackerySpytz. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9163 merged ZackerySpytz, 2018-09-11 07:33
Messages (5)
msg309438 - (view) Author: Jakub Wilk (jwilk) Date: 2018-01-03 21:34
Python 3.6.4 (default, Jan  3 2018, 21:10:22) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call('nonexistent')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/subprocess.py", line 267, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/local/lib/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.6/subprocess.py", line 1344, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent': 'nonexistent'


Note that the name of the missing file is mentioned twice in the error message.
(Strictly speaking it's once in the message, and once in the filename attribute, but for a casual observer, the effect is the same.)
msg325012 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-09-11 14:45
This code was added in issue4925. Is the original problem gone?
msg325016 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-09-11 15:25
The builtin exception is better now, so I don't see a problem with reverting the original patch.
msg325019 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-09-11 15:54
New changeset 73870bfeb9cf350d84ee88bd25430c104b3c6191 by Benjamin Peterson (Zackery Spytz) in branch 'master':
closes bpo-32490: Fix filename duplication in subprocess exception message. (GH-9163)
https://github.com/python/cpython/commit/73870bfeb9cf350d84ee88bd25430c104b3c6191
msg325488 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2018-09-16 14:26
There was also some relevant discussion in #22536.
History
Date User Action Args
2018-09-16 14:26:50ZackerySpytzsetmessages: + msg325488
2018-09-11 15:54:10benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg325019

stage: patch review -> resolved
2018-09-11 15:25:09benjamin.petersonsetmessages: + msg325016
2018-09-11 14:45:12serhiy.storchakasetnosy: + serhiy.storchaka, benjamin.peterson
messages: + msg325012
2018-09-11 07:37:04ZackerySpytzsetnosy: + ZackerySpytz

versions: + Python 3.6, Python 3.7, Python 3.8
2018-09-11 07:33:30ZackerySpytzsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8606
2018-01-03 21:34:31jwilkcreate