When I run my script I can see it enter into the try and complete all lines right up to the if statement, then it skips the if statement and ignores the except.
I've added print statements (removed if shown code) that narrowed down entering the try catch but failing at the if statement, and skipping the except.
while True:
now = time.time()
try:
data = get_out_temp()
if data[0] < 15:
msg = 'There is a storm {} miles away bearing {} at {}'.format(data[0], data[1], time.ctime(now))
tph = "Storm proximity Warning"
except:
print("entered exception")
msg = "Unable to retrieve valid data from DarkSky at {}".format(time.ctime(now))
tph = "Data Failure"
Mbox(tph, msg)
time.sleep(900)
This should either run the except statement or print the results from the list returned from get_out_temp
Aucun commentaire:
Enregistrer un commentaire