Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have been using camelot for our project, but since 2 days I got following errorMessage. When trying to run following code snippet:
import camelot
tables = camelot.read_pdf('C:\\Users\\user\\Downloads\\foo.pdf', pages='1')
I get this error:
DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
I checked this file and it does use pdfFileReader: c:\ProgramData\Anaconda3\lib\site-packages\camelot\handlers.py
I thought that I can specify the version of PyPDF2, but it will be installed automatically(because the library is used by camelot) when I install camelot. Do you think there is any solution to specify the version of PyPDF2 manually?
–
This is issues #339.
While there will hopefully be soon a release including the fix, you can still do this:
pip install 'PyPDF2<3.0'
after you've installed camelot.
See https://github.com/camelot-dev/camelot/issues/339#issuecomment-1367331630 for details and screenshots.
–
–
DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
Just removing the file from pdfFileReader
worked for me. This means writing this PdfReader instead of pdfFileReader
this.
I just changed the imports as the error msg suggested:
# From
from PyPDF2 import PdfFileMerger
from PyPDF2 import PdfFileReader
from PyPDF2 import PdfMerger
from PyPDF2 import PdfReader
In my case (version PyPDF2 3.0.0
) both classes exists.
And I thought that I need to change the code or something, but no, simply worked.
I solved the issue uninstalling camelot-py and re installing it includeing the "extra cv requirement", like this:
pip install "camelot-py[base]"
I hope it can be useful!
source: https://readthedocs.org/projects/camelot-py/downloads/pdf/master/
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.