记录一下excel2img.export_img的一个大坑!object has no attribute ‘parent‘

报错:

  File "C:\Users\xx\AppData\Local\Programs\Python\Python38\lib\site-packages\excel2img\excel2img.py", line 113, in export_img
    for shape in rng.parent.Shapes: pass
  File "C:\Users\xx\AppData\Local\Programs\Python\Python38\lib\site-packages\win32com\client\__init__.py", line 580, in __getattr__
    raise AttributeError(
AttributeError: '<win32com.gen_py.Microsoft Excel 16.0 Object Library.Range instance at 0x2426291144016>' object has no attribute 'parent'

在这里插入图片描述

解决方法:

查了半天中文互联网上没有解决方案,终于在stackoverflow上看到了问题所在:
在Excel 2016文件格式中,属性parent更改为Parent。由于Python区分大小写,因此无法找到适当的属性。
把excel2img的源代码第113行中的parent改成首字母大写就行:
在这里插入图片描述

附上链接:https://stackoverflow.com/questions/57173575/pythons-excel2img-package-not-working-with-ms-office-2016

对你有帮助能给我一个like吗~

  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值