diff --git a/modules/Weather.py b/modules/Weather.py index b38c335..aa662e1 100644 --- a/modules/Weather.py +++ b/modules/Weather.py @@ -20,6 +20,8 @@ along with this program. If not, see . from extlib import irclib from extlib import pywapi +from urllib2 import URLError + from Module import Module class Weather(Module): @@ -38,9 +40,10 @@ class Weather(Module): weatherstr += " " + city['day_of_week'].encode('utf-8') + ": " + city['condition'].encode('utf-8') + ". High " + city['high'].encode('utf-8') + "°F, Low " + city['low'].encode('utf-8') + "°F." return self.reply(connection, replypath, unicode(weatherstr, 'utf-8')) + except URLError as e: + return self.reply(connection, replypath, "error connecting to google weather:" + str(e)) except IndexError as e: - print("error in pywapi: " + str(e)) - return + return self.reply(connection, replypath, "error in pywapi: " + str(e)) # vi:tabstop=4:expandtab:autoindent # kate: indent-mode python;indent-width 4;replace-tabs on;