Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

self.PASSWORD_PADDING type error #315

Open
FANGOD opened this issue Mar 24, 2022 · 0 comments
Open

self.PASSWORD_PADDING type error #315

FANGOD opened this issue Mar 24, 2022 · 0 comments

Comments

@FANGOD
Copy link

FANGOD commented Mar 24, 2022

➜  Desktop python3 samples.py
Traceback (most recent call last):
  File "samples.py", line 212, in <module>
    with pdfplumber.open(file_name, password="") as pdf:
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfplumber/pdf.py", line 55, in open
    inst = cls(fp, **kwargs)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfplumber/pdf.py", line 32, in __init__
    self.doc = PDFDocument(PDFParser(stream), password=password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 575, in __init__
    self._initialize_password(password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 599, in _initialize_password
    handler = factory(docid, param, password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 300, in __init__
    self.init()
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 307, in init
    self.init_key()
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 320, in init_key
    self.key = self.authenticate(self.password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 368, in authenticate
    key = self.authenticate_user_password(password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 374, in authenticate_user_password
    key = self.compute_encryption_key(password)
  File "/home/johnny/.local/lib/python3.8/site-packages/pdfminer/pdfdocument.py", line 351, in compute_encryption_key
    password = (password + self.PASSWORD_PADDING)[:32]  # 1
TypeError: can only concatenate str (not "bytes") to str

pdfplumber default passwd ispassword='', use password=''.encode() to skip this error or pdfminer.pdfdocument.PDFEncryptionError.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant