Nov-23-2019, 09:18 AM
Very new to python, grew up on PHP. I'm using the pdftitle module, for its intended purpose, don't seem to be able to gracefully handle it throwing exceptions.
Exceptions I've come across are either recursion limit or "pdfminer.pdffont.PDFUnicodeNotDefined". I'm happy to just skip the documents where these occur but have been unable to. Not sure if the cause us "During handling of the above exception, another exception occurred:" or overall nesting from the module?
Exceptions I've come across are either recursion limit or "pdfminer.pdffont.PDFUnicodeNotDefined". I'm happy to just skip the documents where these occur but have been unable to. Not sure if the cause us "During handling of the above exception, another exception occurred:" or overall nesting from the module?
try: PdfTitle = pdftitle.run(FilePath) except: print(FilePath) print("an exception occurred")Expected result - file name and "an exception occurred" are printed, actual result is the exception output:
Traceback (most recent call last): File "C:\Program Files (x86)\Python38-32\lib\site-packages\pdfminer\pdffont.py", line 580, in to_unichr return self.cid2unicode[cid] KeyError: 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Program Files (x86)\Python38-32\lib\s ... File "C:\Program Files (x86)\Python38-32\lib\site-packages\pdfminer\pdffont.py", line 582, in to_unichr raise PDFUnicodeNotDefined(None, cid) pdfminer.pdffont.PDFUnicodeNotDefined: (None, 1)