I'm trying to run a script using the module PyPDF2 (Windows) but it looks like its not working or outdated:
from PyPDF2 import PdfFileReader, PdfFileWriter
ModuleNotFoundError: No module named 'PyPDF2'
Is it actually not working? I already updated pip and installed the module
pip install PyPDF2
Requirement already satisfied: PyPDF2 in c:\users\desmin\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (1.26.0)
If its not working can anyone help me with an alternative to build this piece?
from PyPDF2 import PdfFileReader, PdfFileWriter
file_path = '1984.pdf'
pdf = PdfFileReader(file_path)
with open('1984 Note.txt', 'w') as f:
for page_num in range(pdf.numPages):
# print('Page : {0}' .format(page_num))
pageObj = pdf.getPage(page_num)
try:
txt = pageObj.extractText()
print(''.center(100, '-'))
except:
pass
else:
f.write('Page {0}\n ' .format(page_num+1))
f.write(''.center(100, '-'))
f.close()