Message400948
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 |
|
Date |
User |
Action |
Args |
2021-09-02 19:37:44 | sahsariga111 | set | recipients:
+ sahsariga111, larry |
2021-09-02 19:37:44 | sahsariga111 | set | messageid: <1630611464.91.0.0686347967364.issue45087@roundup.psfhosted.org> |
2021-09-02 19:37:44 | sahsariga111 | link | issue45087 messages |
2021-09-02 19:37:44 | sahsariga111 | create | |
|