TwitchIO icon indicating copy to clipboard operation
TwitchIO copied to clipboard

A weird _process_data error in console

Open Commaster opened this issue 1 year ago • 9 comments

Traceback (most recent call last):
  File ".../python3.8/site-packages/twitchio/websocket.py", line 308, in _process_data            
    await partial_(parsed)                                 
  File ".../python3.8/site-packages/twitchio/websocket.py", line 427, in _usernotice              
    tags = dict(x.split("=") for x in rawData.split(";"))  
ValueError: dictionary update sequence element #21 has length 3; 2 is required

I have no clue how or why this happened 🤔

Commaster avatar Jul 13 '22 15:07 Commaster

Hello! Thanks for the issue. If this is a general help question, for a faster response consider joining the official Discord Server

Else if you have an issue with the library please wait for someone to help you here.

github-actions[bot] avatar Jul 13 '22 15:07 github-actions[bot]

The cause of this is possibly due to an = in the message content of a subscription message or other USERNOTICE message.

chillymosh avatar Jul 13 '22 17:07 chillymosh

Does this error break the asyncio event loop requiring a restart? Or it just skips that one packet and continues working properly?

Commaster avatar Jul 18 '22 14:07 Commaster

It will continue running

chillymosh avatar Jul 18 '22 14:07 chillymosh

Maybe x.split("=", maxsplit=1) will solve this? 🤔

Commaster avatar Aug 09 '22 13:08 Commaster

We were waiting for the merge of the and refactoring of the IRC parser before addressing this. We will look further into it soon.

chillymosh avatar Aug 09 '22 13:08 chillymosh

@Commaster tags = dict(x.split("=", 1) for x in rawData.split(";")) will most likely work if you would like to test locally on 2.4.0

install direct from git

python -m pip install -U --force-reinstall git+https://github.com/TwitchIO/TwitchIO.git

chillymosh avatar Aug 09 '22 19:08 chillymosh

Oh! I was wondering why 2.4.0 wasn't showing up in pypi. Thank you, I shall try! (Though I haven't seen this exact error in quite some time, mostly just #209)

Commaster avatar Aug 10 '22 08:08 Commaster

@Commaster 2.4.0 is now available on pypi. We have updated the join_channels logic in this version, although not sure how #209 is relevant to this issue. Try updating to 2.4.0 then update line 444 in websockets.py to the above and test it over a few days / weeks

chillymosh avatar Aug 10 '22 08:08 chillymosh

Revisiting this since I am going to be updating some websocket / parser things soon, I believe the user-type also needs to be amended here

tags = dict(x.split("=", 1) for x in rawData.split(";"))
tags["user-type"] = tags["user-type"].split(":tmi.twitch.tv")[0].strip()

chillymosh avatar Sep 24 '22 14:09 chillymosh

@Commaster pushed to Master

chillymosh avatar Oct 04 '22 06:10 chillymosh