美文网首页
Openpyxl 3.1.1 'TextBlock' obje

Openpyxl 3.1.1 'TextBlock' obje

作者: 拥抱月亮的大星星 | 来源:发表于2023-02-23 15:09 被阅读0次

解决方案 pip install lxml

As I wrote on the [mailing list](https://groups.google.com/g/openpyxl-users/c/ztrHJwWwfRU/m/ce3lFIvPGgAJ), this problem only occurs with **etree**, and not with **lxml**.
This explains why it works on some machines and fails on others.

See:

*   [text = r.name in etree_write_cell()](https://foss.heptapod.net/openpyxl/openpyxl/-/blob/e106fc0e5b3033d2e2846d2fffc1e29f0ab7d260/openpyxl/cell/_writer.py#L82)
*   [value = r.text in lxml_write_cell()](https://foss.heptapod.net/openpyxl/openpyxl/-/blob/e106fc0e5b3033d2e2846d2fffc1e29f0ab7d260/openpyxl/cell/_writer.py#L139)

So, if you have this issue, try installing lxml.
If you don't have this issue and want to reproduce it, set the environment variable OPENPYXL_LXML to False

相关文章

网友评论

      本文标题:Openpyxl 3.1.1 'TextBlock' obje

      本文链接:https://www.haomeiwen.com/subject/gbttldtx.html