From 2dcb56fd9141acb794474ce5db8dd1af09d56b9b Mon Sep 17 00:00:00 2001 From: SDK Date: Wed, 7 Sep 2016 18:16:40 -0400 Subject: [PATCH] Found a bug and fixed it ontop of my code. Some ips actually don't get locations so I added some code to where you guys set the location to check if the location returns nothing ( location2 == ", " ) to make the location label to say "cannot pinpoint location" instead of the naked , under the weather. --- smartmirror.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/smartmirror.py b/smartmirror.py index 8cce241e..a9ac5679 100644 --- a/smartmirror.py +++ b/smartmirror.py @@ -154,8 +154,12 @@ def get_weather(self): self.temperature = temperature2 self.temperatureLbl.config(text=temperature2) if self.location != location2: - self.location = location2 - self.locationLbl.config(text=location2) + if location2 == ", ": + self.location = "Cannot Pinpoint Location" + self.locationLbl.config(text="Cannot Pinpoint Location") + else: + self.location = location2 + self.locationLbl.config(text=location2) except Exception as e: traceback.print_exc() print "Error: %s. Cannot get weather." % e