XMLConverter中意外的关键字参数'codec' [英] unexpected keyword argument 'codec' in XMLConverter

查看:109
本文介绍了XMLConverter中意外的关键字参数'codec'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下错误消息:

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

原始代码:

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

这在我的项目设置(python 3.5.3)中工作正常,但在新设置(python 3.7.4)中却无法正常工作.不知道这是否仍然是一个问题,或者现在是否有新版本的XMLConverter

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

推荐答案

克里斯怀疑,此问题是由于版本不匹配所致.pdfminer的2019年版本在该方法中没有关键字编解码器.所以我安装了较旧版本的pdfminer 20181108,该版本也用于我的项目中.现在代码可以正常运行了

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

这篇关于XMLConverter中意外的关键字参数'codec'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆