This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: FileNotFound error raised by os.exec* doesn't contain filename
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: russelldavis, taleinat
Priority: normal Keywords: patch

Created on 2020-05-05 05:56 by russelldavis, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 19915 open russelldavis, 2020-05-05 05:59
Messages (3)
msg368106 - (view) Author: Russell Davis (russelldavis) * Date: 2020-05-05 05:56
To repro:

>>> import os, sys
>>> os.execv("nosuchfile", ["nosuchfile"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory
>>> print(sys.last_value.filename)
msg378835 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2020-10-17 21:10
I agree that having the error message include the executable name could be useful.
msg378857 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2020-10-18 09:16
After further reading, especially the docs for OSError which describe the filename and filename2 attributes, I agree that setting .filename on the FileNotFoundError exception is the way to go.
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84687
2020-10-18 09:16:10taleinatsetmessages: + msg378857
2020-10-17 21:10:54taleinatsettype: enhancement
versions: + Python 3.10, - Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9
2020-10-17 21:10:37taleinatsetnosy: + taleinat
messages: + msg378835
2020-05-05 05:59:48russelldavissetkeywords: + patch
stage: patch review
pull_requests: + pull_request19230
2020-05-05 05:56:58russelldaviscreate