[issue45087] Confusing error message when trying split bytes.

Alex Zaslavskis report at bugs.python.org
Thu Sep 2 17:35:08 EDT 2021


Alex Zaslavskis <sahsariga111 at gmail.com> added the comment:

''.split(',') # works as it should be 
b''.split(',') # gives strange error message.

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

The problem here is that message is saying that for fix error you should use bytes-like object that not a true. In reality the string or None is required .

----------

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


More information about the Python-bugs-list mailing list