Python 读取word文档中图片报错TypeError

Debug 模式执行Python代码报错信息如下,

报错信息:TypeError: BaseXmlEnum.__new__() missing 2 required positional arguments: 'xml_value' and 'docstr' Error calling __set_name__ on '_proto_member' instance 'automatic' in 'WD_COLOR_INDEX'

错误信息截图如下:

解决思路:

发现没有进入到代码方法断点位置,因此判断是包版本或者包冲突问题。最终在AI的帮助下步骤2完成后解决上述问题。

请ChatGPT帮忙debug如下:

The error you're encountering seems to be related to a conflict or incompatibility in the enum module used by the docx package. To debug and resolve this issue, try the following steps:

  1. Check the enum34 package: Ensure that you are not using the enum34 backport package, which is meant for Python versions prior to 3.4. This can cause conflicts in Python 3.6 and later.
  2. Update the python-docx package: Ensure that you are using the latest version of python-docx. You can update it using pip:bashCopy codepip install --upgrade python-docx
  3. Check for Conflicting Packages: Sometimes, different packages can introduce conflicts. Ensure that no other packages in your environment are causing this issue.
  4. Check Python Version: Ensure you are using a compatible version of Python. python-docx works well with Python 3.6 and later.
  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值