Subash Nadar
Subash Nadar

Reputation: 101

unexpected keyword argument 'codec' in XMLConverter

Below error message:

device = XMLConverter(rsrcmgr, retstr, laparams=laparams, codec=codec)
TypeError: __init__() got an unexpected keyword argument 'codec'

Original Code:

rsrcmgr = PDFResourceManager()
retstr = BytesIO()
codec = 'utf-8'
laparams = LAParams()
device = XMLConverter(rsrcmgr, retstr, laparams=laparams, codec=codec)

This is surprisingly working fine in my project setup (python 3.5.3) but not in the new setup (python 3.7.4). Not sure if the this is anyways a problem or if a new version of XMLConverter is now available

Upvotes: 4

Views: 8604

Answers (1)

Subash Nadar
Subash Nadar

Reputation: 101

As suspected by chris, this issue is due to version mismatch. 2019 version of pdfminer doesn't have keyword codec in the method. So I installed the older version of pdfminer 20181108 which is used in my project as well. Now the code runs without any error

Upvotes: 5

Related Questions