From 845e558ae06e2bbf0585bdcb4281d78fbff91191 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 29 Jan 2010 14:12:12 -0700 Subject: [PATCH] Don't die if generating default masthead fails --- src/calibre/web/feeds/news.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 113d7dd756..d182d856d8 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -770,7 +770,11 @@ class BasicNewsRecipe(Recipe): self.download_masthead(murl) if self.masthead_path is None: self.masthead_path = os.path.join(self.output_dir, 'mastheadImage.jpg') - self.default_masthead_image(self.masthead_path) + try: + self.default_masthead_image(self.masthead_path) + except: + self.log.exception('Failed to generate default masthead image') + self.masthead_path = None if self.test: feeds = feeds[:2] @@ -1061,7 +1065,7 @@ class BasicNewsRecipe(Recipe): opf = OPFCreator(dir, mi) # Add mastheadImage entry to section mp = getattr(self, 'masthead_path', None) - if mp is not None: + if mp is not None and os.access(mp, os.R_OK): from calibre.ebooks.metadata.opf2 import Guide ref = Guide.Reference(os.path.basename(self.masthead_path), os.getcwdu()) ref.type = 'masthead'