From cf9d7fc7102f75f80fa8f4def53d962a8da3d3e5 Mon Sep 17 00:00:00 2001 From: Joseph Pintozzi Date: Sun, 27 Oct 2019 17:40:41 -0700 Subject: [PATCH] Safer handling of extreme sleep --- checkin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checkin.py b/checkin.py index 0619d75..739c833 100755 --- a/checkin.py +++ b/checkin.py @@ -39,7 +39,11 @@ def schedule_checkin(flight_time, reservation): m, s = divmod(delta, 60) h, m = divmod(m, 60) print("Too early to check in. Waiting {} hours, {} minutes, {} seconds".format(trunc(h), trunc(m), s)) - time.sleep(delta) + try: + time.sleep(delta) + except OverflowError: + print("System unable to sleep for that long, try checking in closer to your departure date") + sys.exit(1) data = reservation.checkin() for flight in data['flights']: for doc in flight['passengers']: