[Tutor] TypeError: not all arguments converted during string formatting
Keitaro Kaoru
tokyo.rook at gmail.com
Mon Jul 9 17:31:29 CEST 2012
Traceback (most recent call last):
File "bot.py", line 351, in <module>
mgr.main()
File "/home/bot/bot/ch.py", line 1672, in main
con._feed(data)
File "/home/bot/bot/ch.py", line 628, in _feed
self._process(food.decode("latin-1").rstrip("\r\n")) #numnumz ;3
File "/home/bot/bot/ch.py", line 643, in _process
getattr(self, func)(args)
File "/home/bot/bot/ch.py", line 744, in rcmd_u
self._callEvent("onMessage", msg.user, msg)
File "/home/bot/bot/ch.py", line 1091, in _callEvent
self.mgr.onEventCalled(self, evt, *args, **kw)
File "bot.py", line 287, in onEventCalled
self.invokeListeners(room, evt, *args, **kw)
File "bot.py", line 110, in invokeListeners
getattr(lis, evt)(self, room, *args, **kw)
File "modules/lulz2.py", line 47, in onMessage
self.sendObject(room, ret)
File "bot.py", line 307, in sendObject
obj = obj.__botOut__(self, room)
File "/home/bot/bot/tools.py", line 226, in __botOut__
return self.html % ca
TypeError: not all arguments converted during string formatting
class Text:
def __init__(self, text):
self.text = text
def __botOut__(self, mgr, room):
return cgi.escape(self.text)
class Html:
def __init__(self, html, *args):
self.html = html
self.args = args
def __botOut__(self, mgr, room):
if len(self.args) == 0:
return self.html
else:
ca = tuple([cgi.escape(arg) if type(arg) == str else arg for arg in
self.args])
return self.html % ca
cant seem to find out whats wrong with it
--
~~Austin
More information about the Tutor
mailing list