Closed bookemdano08 closed 8 years ago
This is a bug that the bot picked up somewhere along the way, doesn't have to do with dependencies or configuration.
I think what's happening is that it's throwing an exception in the _standings() function, but that exception is being caught and silenced by the IRC message handler privmsg() which is the caller a few levels up.
On our network we probably noticed it some time ago and failed to care or look into it much because someone else wrote a python thing that displays the scores on a webpage.
I'll set something up for testing and see about fixing it Soon™.
Alternatively, if you fix it I'll merge it. :) Truthfully, that may be faster since this bot is perpetually on the backburner for me.
You can see the stacktrace if you take the exception handling part in privmsg and change it from:
except:
return
to:
except Exception as e:
print e
return
And pay attention to the shell it's running in.
So, I also wrote this bot when I was learning python. There is a lot of badness in it that I'm not proud of. FYI.
Thanks for the replies rawsonj. Any badness present in your code will go unnoticed by me because I've got no coding skills (python nor anything else) whatsoever. I'm just an IT guy with no fear!
I changed the script as you suggested and when issuing the ?standings command I saw this in the shell:
<lambda>() takes exactly 2 arguments (1 given)
The relevant (I think) code from trivia.py is:
sorted_scores = sorted(self._scores.iteritems(), key=lambda k, v: (v, k), reverse=True)
Sorry for needing handholding with this. I'll keep playing around, but if you see anything obvious please let me know. Thanks again.
Don't apologize. We all start from somewhere.
I'll look at it and see what's going on. Maybe it's a trivial fix. (haha, trivial...)
Found it. The lambda needed a set of parens around k, v.
Fixed in 422c21a.
I've tested on my side, I'm sure it will work for you.
Thanks rawsonj! Can confirm it works fine now.
First of all, my apologies that I'm unable to figure out how to fix this myself. It is quite likely a configuration issue on my end.
FreeBSD 10.0 & Python 2.7.12 installed via ports.
only changes I made to config.py were: GAME_CHANNEL = '#triviatesting' ADMINS = ['mynick'] DEFAULT_NICK = 'dantriviabot' SERVER_PORT = 6697
The bot seems to work OK, and it is keeping track of scores (the ?score command reports the correct points total, even if the bot is killed and re-started) but whenever it spits out standings (or if I issue the ?standings command) it just says:
dantriviabot: The current trivia standings are:
and that's it (ETA: it doesn't crash, it just doesn't provide any list of names). I barely know anything about python so I'm sort of unsure as to whether I have something misconfigured or if there's some other package I need to install. Any ideas? Thanks!