Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Help (EOF marker not found)

Hello to everyone, I need help about this little python script...

Basically I wanted to go thru my files and check which PDFs are password encrypted, but running this script, after 5 seconds I get this error:"PyPDF2.utils.PdfReadError: EOF marker not found"

Code
import PyPDF2
import os

directory = "G:\PDFs"

for root, dirs, files in os.walk(directory):
    for file in files:
        if file.endswith((".pdf")):
            selected = root + "\\" + file
            pdfFile = open(selected, "rb")
            pdfRead = PyPDF2.PdfFileReader(pdfFile)
            if pdfRead.isEncrypted == True:
                print(selected)
PyPDF2 seems to be unmaintained for like 5 years.

There's a bunch of unmaintained libraries that also seem to have a problem with malformed/missing EOF markers.

I'd use a maintained library like pdfminer or pikepdf. They look like they don't have any glaring issues.
[Image: 3943c24fb6058003233768a9747351d2.png]
(Jun 29, 2021 01:57 PM)L E G I Ø N Wrote:  PyPDF2 seems to be unmaintained for like 5 years.

There's a bunch of unmaintained libraries that also seem to have a problem with malformed/missing EOF markers.

I'd use a maintained library like pdfminer or pikepdf. They look like they don't have any glaring issues.

Thank You for suggestion, will try it...


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by TreasuretrioAug 2, 2020 08:01 PM 2 151 Aug 2, 2020 08:01 PM
Last Post: Treasuretrio
[C] by RealyWhiteJan 5, 2019 11:12 AM 9 334 Jan 5, 2019 11:12 AM
Last Post: Mayuko
[C#] by gigajewMar 13, 2018 06:00 PM 6 426 Mar 13, 2018 06:00 PM
Last Post: gigajew