"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.1
Code + 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
"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)
Traceback
This is the complete Traceback I see: