New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: 'NumberObject' object is not subscriptable #1273
Comments
@DL6ER Thank you for sharing this issue and all the details you put in here (and in all the other issues as well) 🤗 I appreciate this a lot ❤️ |
One part that might be interesting to you: Hence this: import PyPDF2
with open("shiv_resume.pdf", "rb") as f:
pdfreader = PyPDF2.PdfFileReader(f, strict=False) can be simplified to this: from PyPDF2 import PdfReader
reader = PdfReader("shiv_resume.pdf") |
Just to clarify: |
the PDF file is linearized. and there seems to be some issues in reading this part of the header. I will deeper analyze it later |
Exactly! PyPDF2 takes care of that: https://github.com/py-pdf/PyPDF2/blob/main/PyPDF2/_reader.py#L272-L274 - no file handles are left open. That is also the reason why I typically recommend to pass the file path directly to PyPDF2 |
the problem is not directly due to "Linearization"but to other errors (generated by linearization process ???)
PR #1297 completed |
* if chained xref/trailer are not good * if the object header ('id' 'gen' obj) or if the object is not present in the xref table, will search the file for the object. fixes py-pdf#1273
See #1269 for further details.
Environment
Which environment were you using when you encountered the problem?
$ python -m platform Linux-5.4.0-122-generic-x86_64-with-glibc2.29 $ python -c "import PyPDF2;print(PyPDF2.__version__)" 2.10.3
Code + PDF
This is a minimal, complete example that shows the issue:
PDF used above: shiv_resume.pdf
Traceback
This is the complete Traceback I see:
The text was updated successfully, but these errors were encountered: