[issue39840] FileNotFoundError et al show b-prefix on filepaths if passed as bytes

Augie Fackler report at bugs.python.org
Tue Mar 3 14:53:30 EST 2020


New submission from Augie Fackler <lists at durin42.com>:

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.

----------
messages: 363297
nosy: durin42
priority: normal
severity: normal
status: open
title: FileNotFoundError et al show b-prefix on filepaths if passed as bytes
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39840>
_______________________________________


More information about the Python-bugs-list mailing list