From 12c5170815b3a86b98434841de73cfc4f8b0e08d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 17 Oct 2014 00:03:13 -0500 Subject: [PATCH] Catch another exception thrown by pdfminer. --- earwigbot/wiki/copyvios/parsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/earwigbot/wiki/copyvios/parsers.py b/earwigbot/wiki/copyvios/parsers.py index 4df2cba..3567cc3 100644 --- a/earwigbot/wiki/copyvios/parsers.py +++ b/earwigbot/wiki/copyvios/parsers.py @@ -34,6 +34,7 @@ converter = importer.new("pdfminer.converter") pdfinterp = importer.new("pdfminer.pdfinterp") pdfpage = importer.new("pdfminer.pdfpage") pdftypes = importer.new("pdfminer.pdftypes") +psparser = importer.new("pdfminer.psparser") __all__ = ["ArticleTextParser", "get_parser"] @@ -206,7 +207,7 @@ class _PDFParser(_BaseTextParser): pages = pdfpage.PDFPage.get_pages(StringIO(self.text)) for page in pages: interp.process_page(page) - except pdftypes.PDFException: + except (pdftypes.PDFException, psparser.PSException): return output.getvalue().decode("utf8") finally: conv.close()