diff --git a/admin.py b/admin.py index d05178ea7f..6a02b63458 100644 --- a/admin.py +++ b/admin.py @@ -217,7 +217,3 @@ def save_config(bot, trigger): if not trigger.admin: return bot.config.save() - - -if __name__ == '__main__': - print __doc__.strip() diff --git a/calc.py b/calc.py index 82de164abb..bacf11d227 100644 --- a/calc.py +++ b/calc.py @@ -13,8 +13,11 @@ from willie.module import commands, example from willie.tools import eval_equation from socket import timeout -import string -import HTMLParser +import sys +if sys.version_info.major < 3: + import HTMLParser +else: + import html.parser as HTMLParser @commands('c', 'calc') @@ -63,7 +66,7 @@ def wa(bot, trigger): except timeout as e: return bot.say('[WOLFRAM ERROR] Request timed out') if answer: - answer = answer.decode('string_escape') + answer = answer.decode('unicode_escape') answer = HTMLParser.HTMLParser().unescape(answer) # This might not work if there are more than one instance of escaped # unicode chars But so far I haven't seen any examples of such output @@ -73,7 +76,7 @@ def wa(bot, trigger): char_code = match.group(1) char = unichr(int(char_code, 16)) answer = answer.replace('\:' + char_code, char) - waOutputArray = string.split(answer, ";") + waOutputArray = answer.split(";") if(len(waOutputArray) < 2): if(answer.strip() == "Couldn't grab results from json stringified precioussss."): # Answer isn't given in an IRC-able format, just link to it. diff --git a/rss.py b/rss.py index e283c2ab15..a115f9b50c 100644 --- a/rss.py +++ b/rss.py @@ -395,7 +395,7 @@ def disable_feed(): try: fp = feedparser.parse(feed.url, etag=feed.etag, modified=feed.modified) - except IOError, e: + except IOError as e: bot.debug(__file__, "Can't parse feed on {0}, disabling ({1})".format( feed.name, str(e)), 'warning') disable_feed() diff --git a/youtube.py b/youtube.py index fa3af09745..236840fa7f 100644 --- a/youtube.py +++ b/youtube.py @@ -2,7 +2,7 @@ """ youtube.py - Willie YouTube Module Copyright 2012, Dimitri Molenaars, Tyrope.nl. -Copyright © 2012-2013, Elad Alfassa, +Copyright © 2012-2014, Elad Alfassa, Copyright 2012, Edward Powell, embolalia.net Licensed under the Eiffel Forum License 2. @@ -15,8 +15,11 @@ from willie.module import rule, commands, example import json import re -from HTMLParser import HTMLParser - +import sys +if sys.version_info.major < 3: + from HTMLParser import HTMLParser +else: + from html.parser import HTMLParser def setup(bot): regex = re.compile('(youtube.com/watch\S*v=|youtu.be/)([\w-]+)')