From 617eb42f175b52ce4fc42d59eb9b6b5c4f7056b5 Mon Sep 17 00:00:00 2001 From: "Robert \"Red\" English" Date: Mon, 10 Jun 2013 17:39:54 -0300 Subject: [PATCH] Fixed bug in weather.py Weather.py doesn't always receive the correct data for visibility and fails silently - this prevents that. --- plugins/weather.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/weather.py b/plugins/weather.py index dcd8fd4..37b3f9d 100755 --- a/plugins/weather.py +++ b/plugins/weather.py @@ -35,10 +35,13 @@ def get_weather(location): data['wind']['text'] = 'N' # visibility and pressure conversions - 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)) + 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']