对于节点中的_name:TypeError:"NoneType"对象不可迭代 [英] for _name in node: TypeError: 'NoneType' object is not iterable
本文介绍了对于节点中的_name:TypeError:"NoneType"对象不可迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在 Ubuntu服务器
当我使用以下命令时
from openpyxl import load_workbook,Workbook
book = load_workbook(filename='/var/www/test.xlsx')
抛出错误
for _name in node:
TypeError: 'NoneType' object is not iterable
但是在本地系统中一切正常.有谁知道为什么会这样以及如何解决呢?
but everything fine in local system. Any one know why this is happening and how to solve this?
更新
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/openpyxl/reader/excel.py", line 202, in load_workbook
parsed_styles = read_style_table(archive)
File "/usr/local/lib/python2.7/dist-packages/openpyxl/reader/style.py", line 181, in read_style_table
p.parse()
File "/usr/local/lib/python2.7/dist-packages/openpyxl/reader/style.py", line 53, in parse
self.parse_named_styles()
File "/usr/local/lib/python2.7/dist-packages/openpyxl/reader/style.py", line 109, in parse_named_styles
names = self._parse_style_names()
File "/usr/local/lib/python2.7/dist-packages/openpyxl/reader/style.py", line 128, in _parse_style_names
for _name in node:
TypeError: 'NoneType' object is not iterable
推荐答案
我今天在Windows上遇到了这个问题.
I ran into this problem today on Windows.
原来是因为在保存文件时,在另存为类型:"下选择了Strict Open XML Spreadsheet (*.xlsx)
.
It turned out it was because while saving the file, under "Save as type: " I selected Strict Open XML Spreadsheet (*.xlsx)
.
当我将其另存为Excel Workbook (*.xlsx)
我假设所有.xlsx
个文件都相同,显然不是这种情况.
I had assumed all .xlsx
files were the same, this is apparently not the case.
这篇关于对于节点中的_name:TypeError:"NoneType"对象不可迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文