butterscotchstallion / limnoria-plugins

A smattering of Limnoria plugins I've written
MIT License
14 stars 14 forks source link

SpiffyTitles: NameError: name 'unicode' is not defined #91

Closed rostob closed 7 years ago

rostob commented 8 years ago

In SpiffyTitles, plugin.py running on Python 3.4.2:

1: A YouTube url causes the following:

ERROR 2016-11-17T21:04:08 Uncaught exception in SpiffyTitles.__call__:
Traceback (most recent call last):
  File "/home/datase/.local/lib/python3.4/site-packages/supybot/log.py", line 363, in m
    return f(self, *args, **kwargs)
  File "/home/datase/.local/lib/python3.4/site-packages/supybot/irclib.py", line 132, in __call__
    method(irc, msg)
  File "/home/datase/supybot/plugins/SpiffyTitles/plugin.py", line 339, in doPrivmsg
    url = self.get_url_from_message(message)
  File "/home/datase/supybot/plugins/SpiffyTitles/plugin.py", line 1403, in get_url_from_message
    url = self.remove_control_characters(unicode(raw_url))
NameError: name 'unicode' is not defined
ERROR 2016-11-17T21:04:08 Exception id: 0xab80c

2:

A Wikipedia url causes the following:
ERROR 2016-11-17T21:09:54 Uncaught exception in SpiffyTitles.__call__:
Traceback (most recent call last):
  File "/home/datase/.local/lib/python3.4/site-packages/supybot/log.py", line 363, in m
    return f(self, *args, **kwargs)
  File "/home/datase/.local/lib/python3.4/site-packages/supybot/irclib.py", line 132, in __call__
    method(irc, msg)
  File "/home/datase/supybot/plugins/SpiffyTitles/plugin.py", line 368, in doPrivmsg
    title = self.get_title_by_url(url, channel)
  File "/home/datase/supybot/plugins/SpiffyTitles/plugin.py", line 408, in get_title_by_url
    title = handler(url, info, channel)
  File "/home/datase/supybot/plugins/SpiffyTitles/plugin.py", line 904, in handler_wikipedia
    param_string = "&".join("%s=%s" % (key, val) for (key, val) in api_params.iteritems())
AttributeError: 'dict' object has no attribute 'iteritems'
ERROR 2016-11-17T21:09:54 Exception id: 0xf45d5

This is a Python 2 and 3 issue. There are a few more.. seems easily fixable by 2to3.