So i'm a streamer trying to make a twitch plays mod, and im struggling with one error to fix. The original source code was written in python 2.7, but im trying to do this in python 3.11. The code is:
if self.check_has_message(data):
return [self.parse_message(line) for line in filter(None, data.split('\r\n'))];
gave error code:
typeerror: a bytes-like object is required, not 'str'
I tried doing:
if self.check_has_message(data):
return [self.parse_message(line) for line in filter(None, data.decode('utf-8').split('\r\n'))];
did not work.
I have no idea what im doing with this tbh but any help is great!
Traceback (most recent call last):
File "D:\twitchplays\wituz\main.py", line 18, in new_messages = t.twitch_recieve_messages(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\twitchplays\wituz\twitch.py", line 73, in twitch_recieve_messages return [self.parse_message(line) for line in filter(None, data.split('\r\n'))]; ^^^^^^^^^^^^^^^^^^ TypeError: a bytes-like object is required, not 'str'