From af9e34b6d6aca0e7a2de0f3b508455e0e742953c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 11 Jun 2009 14:13:43 -0700 Subject: [PATCH] Fix #2559 (Convert html to Mobil failed) --- src/calibre/ebooks/oeb/base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/base.py b/src/calibre/ebooks/oeb/base.py index 3e16e73ab9..711dce0b8d 100644 --- a/src/calibre/ebooks/oeb/base.py +++ b/src/calibre/ebooks/oeb/base.py @@ -765,7 +765,14 @@ class Manifest(object): data = etree.fromstring(data) except: data=data.replace(':=', '=').replace(':>', '>') - data = etree.fromstring(data) + try: + data = etree.fromstring(data) + except etree.XMLSyntaxError: + self.oeb.logger.warn('Stripping comments from %s'% + self.href) + data = re.compile(r'', re.DOTALL).sub('', + data) + data = etree.fromstring(data) elif namespace(data.tag) != XHTML_NS: # OEB_DOC_NS, but possibly others ns = namespace(data.tag)