pdfminer
pdfminer copied to clipboard
`self.PASSWORD_PADDING` type error
➜ 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
.