From 79cfd37e86a68e44ea1f0b4717b217caff124c6f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Jun 2016 06:32:18 +0530 Subject: [PATCH] Handle astimezone() exceptions when scheduling See http://www.mobileread.com/forums/showthread.php?t=275411 --- src/calibre/web/feeds/recipes/collection.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/calibre/web/feeds/recipes/collection.py b/src/calibre/web/feeds/recipes/collection.py index 856e7eb3a7..1163758c84 100644 --- a/src/calibre/web/feeds/recipes/collection.py +++ b/src/calibre/web/feeds/recipes/collection.py @@ -424,14 +424,20 @@ class SchedulerConfig(object): return utcnow() - ld > timedelta(sch) elif typ == 'day/time': now = nowf() - ld_local = ld.astimezone(local_tz) + try: + ld_local = ld.astimezone(local_tz) + except Exception: + return False day, hour, minute = sch return is_weekday(day, now) and \ not was_downloaded_already_today(ld_local, now) and \ is_time(now, hour, minute) elif typ == 'days_of_week': now = nowf() - ld_local = ld.astimezone(local_tz) + try: + ld_local = ld.astimezone(local_tz) + except Exception: + return False days, hour, minute = sch have_day = False for day in days: @@ -443,7 +449,10 @@ class SchedulerConfig(object): is_time(now, hour, minute) elif typ == 'days_of_month': now = nowf() - ld_local = ld.astimezone(local_tz) + try: + ld_local = ld.astimezone(local_tz) + except Exception: + return False days, hour, minute = sch have_day = now.day in days return have_day and \