From cc7687d83ec7b28ede45f29b22c6ad3185c6c5bf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 5 May 2012 09:58:31 +0530 Subject: [PATCH] Fix #994802 (exception in chm conversion) --- src/calibre/ebooks/conversion/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/conversion/utils.py b/src/calibre/ebooks/conversion/utils.py index 86a4668b9b..4822eee6ae 100644 --- a/src/calibre/ebooks/conversion/utils.py +++ b/src/calibre/ebooks/conversion/utils.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2010, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import re +import re, error as re_error from math import ceil from calibre.ebooks.conversion.preprocess import DocAnalysis, Dehyphenator from calibre.utils.logging import default_log @@ -148,7 +148,7 @@ class HeuristicProcessor(object): return wordcount.words def markup_italicis(self, html): - self.log.debug("\n\n\nitalicize debugging \n\n\n") + #self.log.debug("\n\n\nitalicize debugging \n\n\n") ITALICIZE_WORDS = [ 'Etc.', 'etc.', 'viz.', 'ie.', 'i.e.', 'Ie.', 'I.e.', 'eg.', 'e.g.', 'Eg.', 'E.g.', 'et al.', 'et cetera', 'n.b.', 'N.b.', @@ -184,6 +184,9 @@ class HeuristicProcessor(object): except OverflowError: # match.group(0) was too large to be compiled into a regex continue + except re_error: + # the match was not a valid regular expression + continue return html