[issue45087] Confusing error message when trying split bytes.

Eric V. Smith report at bugs.python.org
Thu Sep 2 18:16:28 EDT 2021


Eric V. Smith <eric at trueblade.com> added the comment:

You said: 
"""
b''.split(',') # gives strange error message.

TypeError: a bytes-like object is required, not 'str'
"""

It is not a strange error message. You passed in a str (the ','), and you should have passed in bytes.

----------

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


More information about the Python-bugs-list mailing list