Fixed bug in weather.py

Weather.py doesn't always receive the correct data for visibility and fails silently - this prevents that.
This commit is contained in:
Robert "Red" English 2013-06-10 17:39:54 -03:00
parent 8c363e5f76
commit 617eb42f17

View file

@ -35,10 +35,13 @@ def get_weather(location):
data['wind']['text'] = 'N'
# visibility and pressure conversions
try:
data['atmosphere']['visibility_km'] = \
int(round(float(data['atmosphere']['visibility']) * 1.609344))
data['atmosphere']['visibility_km'] = \
str(round((float(data['atmosphere']['visibility']) * 33.8637526), 2))
except:
data['atmosphere']['visibility_km'] = "ERR"
# textual value for air pressure
rising = data['atmosphere']['rising']