From 0cecc77a22c2cc91bbb7a5b5b414804808f73976 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 14 Jun 2022 07:58:31 +0530 Subject: [PATCH] The exception raised by datetime when converting epochs has changed --- src/calibre/utils/date.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/date.py b/src/calibre/utils/date.py index ef01743f66..b401f03a3e 100644 --- a/src/calibre/utils/date.py +++ b/src/calibre/utils/date.py @@ -248,12 +248,12 @@ def utcnow(): def utcfromtimestamp(stamp): try: return datetime.utcfromtimestamp(stamp).replace(tzinfo=_utc_tz) - except ValueError: + except Exception: # Raised if stamp is out of range for the platforms gmtime function # For example, this happens with negative values on windows try: return EPOCH + timedelta(seconds=stamp) - except (ValueError, OverflowError): + except Exception: # datetime can only represent years between 1 and 9999 import traceback traceback.print_exc()