From 0570b51fa570d7675973ff09e36bd7f940d54fba Mon Sep 17 00:00:00 2001 From: ncoop Date: Thu, 23 Jun 2016 21:28:42 -0700 Subject: [PATCH] Catch AttributeError also. --- i3pystatus/weather/weathercom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3pystatus/weather/weathercom.py b/i3pystatus/weather/weathercom.py index 5568a54..157c01a 100644 --- a/i3pystatus/weather/weathercom.py +++ b/i3pystatus/weather/weathercom.py @@ -86,11 +86,11 @@ class Weathercom(Backend): # space, hence the use of rpartition). International timezones (or ones # outside the system locale) don't seem to be handled well by # datetime.datetime.strptime(). - observation_time_str = doc.findtext('cc/lsup').rpartition(' ')[0] try: + observation_time_str = doc.findtext('cc/lsup').rpartition(' ')[0] observation_time = datetime.strptime(observation_time_str, '%m/%d/%y %I:%M %p') - except ValueError: + except (ValueError, AttributeError): observation_time = datetime.fromtimestamp(0) pressure_trend_str = doc.findtext('cc/bar/d').lower()