From 42a224f365263bee58f6602eaf82528791c20c16 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Mon, 18 Feb 2019 00:53:04 -0500 Subject: [PATCH] copyvios: Catch PDF parser exceptions more aggressively. --- earwigbot/wiki/copyvios/parsers.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/earwigbot/wiki/copyvios/parsers.py b/earwigbot/wiki/copyvios/parsers.py index 21ccfed..2a4022f 100644 --- a/earwigbot/wiki/copyvios/parsers.py +++ b/earwigbot/wiki/copyvios/parsers.py @@ -34,8 +34,6 @@ nltk = importer.new("nltk") 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"] @@ -294,7 +292,7 @@ class _PDFParser(_BaseTextParser): pages = pdfpage.PDFPage.get_pages(StringIO(self.text)) for page in pages: interp.process_page(page) - except (pdftypes.PDFException, psparser.PSException, AssertionError): + except Exception: # pylint: disable=broad-except return output.getvalue().decode("utf8") finally: conv.close()