From 4196769e1e6375ecb06e01a23c6d597d69097a73 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Wed, 10 Jul 2024 16:12:09 -0700 Subject: [PATCH] Update locationdata.py --- modules/locationdata.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/locationdata.py b/modules/locationdata.py index 34b6463..8a892bd 100644 --- a/modules/locationdata.py +++ b/modules/locationdata.py @@ -123,7 +123,12 @@ def get_weather(lat=0, lon=0, unit=0): # get any alerts and return the count alerts = getWeatherAlerts(lat, lon) alert = alerts[0] - alert_num = int(alerts[1]) + if alert == "No weather alerts found": + alert = "" + alert_num = 0 + else: + alert_num = alerts[1] + if alert_num > 0: # add the alert count warning to the weather weather = str(alert_num) + " local alerts!\n" + weather + "\n" + alert