PDF: attachment extraction was broken since python3 (wrong open mode r instead of rb for the extracted file)

This commit is contained in:
Jean-Francois Dockes 2020-07-27 09:03:58 +02:00
parent 610e3282c3
commit b2e68740ba

View File

@ -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)