From a9a9d8f4ba857d0d6c8fdcf13d2abcf7449a50f1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Apr 2011 08:59:27 -0600 Subject: [PATCH] EPUB Input: Fix EPUB files with empty Adobe PAGE templates causing conversion to abort. Fixes #760390 (epub conversion issue) --- src/calibre/ebooks/oeb/transforms/page_margin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/oeb/transforms/page_margin.py b/src/calibre/ebooks/oeb/transforms/page_margin.py index bc1925e343..d7c99d24c6 100644 --- a/src/calibre/ebooks/oeb/transforms/page_margin.py +++ b/src/calibre/ebooks/oeb/transforms/page_margin.py @@ -20,8 +20,9 @@ class RemoveAdobeMargins(object): self.oeb, self.opts, self.log = oeb, opts, log for item in self.oeb.manifest: - if item.media_type in ('application/vnd.adobe-page-template+xml', - 'application/vnd.adobe.page-template+xml'): + if (item.media_type in ('application/vnd.adobe-page-template+xml', + 'application/vnd.adobe.page-template+xml') and + hasattr(item.data, 'xpath')): self.log('Removing page margins specified in the' ' Adobe page template') for elem in item.data.xpath(