pteichman / cobe

A Markov chain based text generation library and MegaHAL style chatbot
http://teichman.org/blog/
MIT License
242 stars 51 forks source link

IRC client crashes when someone in the room sends any random message #22

Open pizzamaker opened 9 years ago

pizzamaker commented 9 years ago

On version 2.1.0. This is the output:

~$ cobe irc-client -s irc.freenode.net -c "##esperanto" -n babilemulo
INFO: connected to irc.freenode.net:6667
Traceback (most recent call last):
  File "/usr/bin/cobe", line 9, in <module>
    load_entry_point('cobe==2.1.0', 'console_scripts', 'cobe')()
  File "/usr/lib/python2.7/dist-packages/cobe/control.py", line 42, in main
    args.run(args)
  File "/usr/lib/python2.7/dist-packages/cobe/commands.py", line 244, in run
    Runner().run(b, args)
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 118, in run
    bot.start()
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 1221, in start
    self.ircobj.process_forever()
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 267, in process_forever
    self.process_once(timeout)
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 248, in process_once
    self.process_data(i)
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 213, in process_data
    c.process_data()
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 628, in process_data
    self._handle_event(Event(command, NickMask(prefix), target, [m]))
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 650, in _handle_event
    self.irclibobj._handle_event(self, event)
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 387, in _handle_event
    result = handler.callback(connection, event)
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 34, in _dispatcher
    irc.client.SimpleIRCClient._dispatcher(self, c, e)
  File "/usr/lib/python2.7/dist-packages/irc/client.py", line 1184, in _dispatcher
    method(connection, event)
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 66, in on_pubmsg
    user = irc.client.NickMask(event.source()).nick
TypeError: 'NickMask' object is not callable
pteichman commented 9 years ago

Interesting, thanks for the report. What version of the irc library do you have installed?

pizzamaker commented 9 years ago

I'm not sure. I have the latest version of Pidgin, as well as Hexchat and Irssi. How can I check my irc lib version?

pizzamaker commented 9 years ago

Ok, apparently my python-irc version is 8.5.3+dfsg-2

pizzamaker commented 9 years ago

@pteichman have you managed to get a bot functioning normally in an IRC chat room?

pteichman commented 9 years ago

@pizzamaker Aargh, I'm so sorry I've been unresponsive on this.

The version of python-irc that cobe 2.1.2 has been tested with is 12.1.1, and 8.5.3 is about two years old. Are you trying to run cobe from source or from a package? I could see what changes would be necessary to run with 8.5.3.

pizzamaker commented 9 years ago

No worries, @pteichman. I got everything from Trisquel's repository. I'll look into updating python-irc.

pizzamaker commented 9 years ago

Updated it to the latest version (13).

This is the new error output:

~$ cobe irc-client -s irc.freenode.net -c "##esperanto" -n babilemulo
INFO: connected to irc.freenode.net:6667
Traceback (most recent call last):
  File "/usr/bin/cobe", line 9, in <module>
    load_entry_point('cobe==2.1.0', 'console_scripts', 'cobe')()
  File "/usr/lib/python2.7/dist-packages/cobe/control.py", line 42, in main
    args.run(args)
  File "/usr/lib/python2.7/dist-packages/cobe/commands.py", line 244, in run
    Runner().run(b, args)
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 118, in run
    bot.start()
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 1246, in start
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 278, in process_forever
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 259, in process_once
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 216, in process_data
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 582, in process_data
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 614, in _process_line
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 646, in _handle_message
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 673, in _handle_event
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 398, in _handle_event
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 34, in _dispatcher
    irc.client.SimpleIRCClient._dispatcher(self, c, e)
  File "build/bdist.linux-x86_64/egg/irc/client.py", line 1209, in _dispatcher
  File "/usr/lib/python2.7/dist-packages/cobe/irc.py", line 66, in on_pubmsg
    user = irc.client.NickMask(event.source()).nick
TypeError: 'NickMask' object is not callable

Also happens whenever someone in the chatroom says something.