-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Error while reading bookmarks/outlines "TypeError: argument of type 'NoneType' is not iterable" #1059
Copy link
Copy link
Closed
Labels
Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestsA minimal, complete and verifiable example helps a lot to debug / understand feature requestsPdfReaderThe PdfReader component is affectedThe PdfReader component is affectedis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustness
Description
"TypeError: argument of type 'NoneType' is not iterable"
Got this when I tried to read the outlines of a PDF file with PdfReader.outlines.
Environment
Which environment were you using when you encountered the problem?
$ python -m platform
Windows-10-10.0.19044-SP0
$ python -c "import PyPDF2;print(PyPDF2.__version__)"
2.4.1Code + PDF
Example PDF file: sample.pdf (Yes, you can use this file for tests)
from PyPDF2 import PdfReader
reader = PdfReader("sample.pdf")
print(reader.outlines)Traceback
This is the complete Traceback I see:
C:\Users\Hassan\AppData\Local\Programs\Python\Python310\lib\site-packages\PyPDF2\_reader.py:1089: PdfReadWarning: Object 86 0 not defined.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\Hassan\Desktop\main.py", line 3, in <module>
outlines = reader.outlines
File "C:\Users\Hassan\AppData\Local\Programs\Python\Python310\lib\site-packages\PyPDF2\_reader.py", line 674, in outlines
return self._get_outlines()
File "C:\Users\Hassan\AppData\Local\Programs\Python\Python310\lib\site-packages\PyPDF2\_reader.py", line 694, in _get_outlines
if "/First" in lines:
TypeError: argument of type 'NoneType' is not iterable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has MCVEA minimal, complete and verifiable example helps a lot to debug / understand feature requestsA minimal, complete and verifiable example helps a lot to debug / understand feature requestsPdfReaderThe PdfReader component is affectedThe PdfReader component is affectedis-robustness-issueFrom a users perspective, this is about robustnessFrom a users perspective, this is about robustness