Hack Forums
[Python] Help (EOF marker not found) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Help (EOF marker not found) (/showthread.php?tid=6161142)



Help (EOF marker not found) - SkunT3llo - Jun 29, 2021

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)



RE: Help (EOF marker not found) - L E G I Ø N - Jun 29, 2021

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.


RE: Help (EOF marker not found) - SkunT3llo - Jun 29, 2021

(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...