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.

classification
Title: FileNotFoundError et al show b-prefix on filepaths if passed as bytes
Type: behavior Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: durin42, eric.smith
Priority: normal Keywords:

Created on 2020-03-03 19:53 by durin42, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg363297 - (view) Author: Augie Fackler (durin42) * Date: 2020-03-03 19:53
I'm not really sure if this is a bug per se, so please feel encouraged to close as WAI if you like, but:

>>> open(b'foo', 'rb')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: b'foo'

Seems a little weird to me (and it shows up in the UI layer of hg), because the path-as-bytes seems like it shouldn't show up in the human-readable version of the exception (I think I would have expected the fsdecode() of the bytes, for consistency?)

But that's up to you. If the presentation format of this feels right to Python that's no big deal.
msg363307 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2020-03-03 21:41
That behavior is consistent with other exceptions. It's a helpful piece of information if you were to see it in a traceback, without any other context. So this is by design.
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 84021
2020-03-03 21:41:30eric.smithsetstatus: open -> closed

type: behavior

nosy: + eric.smith
messages: + msg363307
resolution: not a bug
stage: resolved
2020-03-03 19:53:30durin42create