Forums

Using library PyPDF2 : AttributeError: 'PageObject' object has no attribute 'extract_text'

Hello I don't understand how use PyFDF2 , because the code are ok on my computer. I can upload and read page but not extract text.

[formatted by admin]

pdfReader = PyPDF2.PdfFileReader(io.BytesIO(file.read()))   
        num_pages = len(pdfReader.pages)
        text = ""

for page in range(num_pages):
            pageObj = pdfReader.pages[page]
            #text += pageObj.extract_text(). <-- this line on error

thank you for your help

regards

Roland

Examine what exactly is the PageObject and what API does it support. If the exact same code is working on your local machine, it's possible you use different version of PyPDF2 there and on PythonAnywhere.

I'm experiencing the same problem. @becareprod, have you solved it? If so, how? @pafk, can you share the solution?

Could you double check the PyPDF2 version?

Resolved.

Great. Was it a version issue?