diff --git a/main.py b/main.py index c18f440..61ae28d 100755 --- a/main.py +++ b/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)