Module Not Found when the Module Exists

Viewed 17
import io

import requests
from pyPdf import PdfFileReader

url = 'http://www.arkansasrazorbacks.com/wp-content/uploads/2017/02/Miami-Ohio-Game-2.pdf'

r = requests.get(url)
f = io.BytesIO(r.content)

reader = PdfFileReader(f)
contents = reader.getPage(0).extractText().split('\n')

is resulting in

Traceback (most recent call last):
  File "C:\Users\james\eclipse-workspace\homework\proj2.py", line 4, in <module>
    from pyPdf import PdfFileReader
  File "C:\Users\james\AppData\Local\Programs\Python\Python310\lib\site-packages\pyPdf\__init__.py", line 1, in <module>
    from pdf import PdfFileReader, PdfFileWriter
ModuleNotFoundError: No module named 'pdf'

I'm at whits end about what this could possibly be, I have just installed pip install pyPdf, I don't know how it could find the module missing when Eclipse IDE isn't throwing erorrs and CMD is noting that the module is there.

1 Answers

This is a known bug for pyPDF. pyPDF is no longer supported, you should use pyPDF2 as suggested in the official page of pypDF. This problem is solved in pyPDF2

Related