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.

Author sahsariga111
Recipients larry, sahsariga111
Date 2021-09-02.19:37:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630611464.91.0.0686347967364.issue45087@roundup.psfhosted.org>
In-reply-to
Content
If we will try to split bytes we will got quite strange error in console. 

Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in <module>
    byte_message.split(",")
TypeError: a bytes-like object is required, not 'str'

The problem here is that object should be string and in if I convert it to string the error is going. So that mean that there are error in mistake . Correct variant should be :
Traceback (most recent call last):
  File "C:/Users/ProAdmin/Desktop/bug_in_python.py", line 6, in <module>
    byte_message.split(",")
TypeError:  str is required, not a bytes-like object


message = 'Python is fun'
byte_message = bytes(message, 'utf-8')
print(byte_message)
#byte_message.split(",") causes error
str(byte_message).split(",") # works
History
Date User Action Args
2021-09-02 19:37:44sahsariga111setrecipients: + sahsariga111, larry
2021-09-02 19:37:44sahsariga111setmessageid: <1630611464.91.0.0686347967364.issue45087@roundup.psfhosted.org>
2021-09-02 19:37:44sahsariga111linkissue45087 messages
2021-09-02 19:37:44sahsariga111create