Browse Source

fixed spam when network connection is dropped

atexit
Raphael Roberts 7 years ago
parent
commit
d24c0fba61
  1. 5
      main.py

5
main.py

@ -188,12 +188,13 @@ def main(args):
timeout = args.periodic
data = ctabus.get_times(stop_id, timeout=timeout)
e = time.perf_counter() - s
if e < args.periodic:
time.sleep(args.periodic-e)
except KeyboardInterrupt:
_done = True
except (urllib.error.URLError, socket.timeout):
e = time.perf_counter() - s
print("Error fetching times")
if e < args.periodic:
time.sleep(args.periodic-e)
else:
show(data, args.route)

Loading…
Cancel
Save