From b2e68740ba6d69f0483c0e5cc06551f084c0a02f Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 27 Jul 2020 09:03:58 +0200 Subject: [PATCH] PDF: attachment extraction was broken since python3 (wrong open mode r instead of rb for the extracted file) --- src/filters/rclpdf.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/filters/rclpdf.py b/src/filters/rclpdf.py index 3dfd10fb..0ac7f051 100755 --- a/src/filters/rclpdf.py +++ b/src/filters/rclpdf.py @@ -212,7 +212,7 @@ class PDFExtractor: return (False, "", "", rclexecm.RclExecM.eofnow) path = os.path.join(tmpdir, ipath) if os.path.isfile(path): - f = open(path) + f = open(path, "rb") docdata = f.read(); f.close() if self.currentindex == len(self.attachlist) - 1: @@ -484,7 +484,9 @@ class PDFExtractor: #self.em.rclog("getnext: returning ok for [%s]" % ipath) return (ok, data, ipath, eof) - except: + except Exception as ex: + self.em.rclog("getnext: extractone failed for index %d: %s" % + (self.currentindex, ex)) return (False, "", "", rclexecm.RclExecM.eofnow)