Catch AttributeError also.

This commit is contained in:
ncoop 2016-06-23 21:28:42 -07:00
parent 806ebe9060
commit 0570b51fa5

View File

@ -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()