Skip to content
Advertisement

Python IndexError after 2800 iterations

JavaScript

For some reason that I don’t get, after calling this for the 2800th time (aprox), it gets into the except part. I’m using this to parse a chat log for easier processing later on a Twitch chat bot, so I have to call the parser a lot of times for it to be updated. Can anyone help? Thanks in advance!

Also, the error seemingly comes from the if config.nickname != i.split(" ")[2] and config.nickname != i.split(" ")[4] and f"{config.nickname} = #{config.channel}" not in i.split("—")[1].split(":")[2] part.

Advertisement

Answer

I finally got it working, the problem here was the PING from the server, it had a different format than the other lines.

That was fixed by switching around the if instructions and first checking if PING was a part of the string. I had a new problem, though, the bot disconnected after a few minutes, just about the same time that took the last problem to be noticed. I was just not responding to the ping. Thanks a lot to the last answer, it helped a lot!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement