pyexcel / openpyxl TypeError:__init __()获得了意外的关键字参数'noTextEdit'

时间:2018-09-27 06:39:43

标签: python openpyxl

我是Python的新手,我曾尝试通过openpyxl和

访问文件

使用以下代码:

+---+--------+--------+-----------+---------+---------+--------------------+--------+----------+----------+
|avg|badCount|effectID|globalCount|goodCount|paramType|               ratio|    tool|  toolName|totalCount|
+---+--------+--------+-----------+---------+---------+--------------------+--------+----------+----------+
|0.0|    32.0|     0.0|       84.0|     52.0|      CAT| 0.38095238095238093|    tool|  litho_c3|    1001.0|
|0.0|     0.0|     0.0|       85.0|     85.0|      CAT|                 0.0|    tool|  litho_c1|    1001.0|
|0.0|    32.0|     0.0|     1001.0|    969.0|      CAT| 0.03196803196803197|  recipe|r_ 15 _1.1|    1001.0|
|0.0|    12.0|     0.0|      335.0|    323.0|      CAT| 0.03582089552238806|operator|     c2_o3|    1001.0|
|0.0|    10.0|     0.0|      328.0|    318.0|      CAT| 0.03048780487804878|operator|     c1_o3|    1001.0|
|0.0|    32.0|     0.0|      248.0|    216.0|      CAT| 0.12903225806451613|    mask|    mask_3|    1001.0|
|0.0|     0.0|     0.0|      263.0|    263.0|      CAT|                 0.0|    mask|    mask_2|    1001.0|

我遇到错误

recipe

EDIT1:我将整行放在这里

import openpyxl
wb1=openpyxl.load_workbook('DATA_G1.xlsm')

Edit2:

TypeError: __init__() got an unexpected keyword argument 'noTextEdit''

Edit3:已解决

发现错误,是由于与Excel工作表中“自动塑形”对象有关的一些错误

>>> import openpyxl
>>> os.chdir('C:\\Users\\stephinj\\OneDrive\\LEARN_CODE')
>>> wb=openpyxl.load_workbook('DATA_G1.xlsm')

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\reader\excel.py", line 276, in load_workbook
for c in find_charts(archive, rel.target):
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\chart\reader.py", line 50, in find_charts
drawing = SpreadsheetDrawing.from_tree(tree)
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\descriptors\serialisable.py", line 84, in from_tree
obj = desc.expected_type.from_tree(el)
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\descriptors\serialisable.py", line 84, in from_tree
obj = desc.expected_type.from_tree(el)
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\descriptors\serialisable.py", line 84, in from_tree
obj = desc.expected_type.from_tree(el)
  [Previous line repeated 1 more times]
  File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\descriptors\serialisable.py", line 100, in from_tree
return cls(**attrib)
TypeError: __init__() got an unexpected keyword argument 'noTextEdit''

1 个答案:

答案 0 :(得分:0)

已解决

发现错误,是由于与Excel工作表中“自动塑形”对象有关的一些错误

File "C:\Users\stephinj\AppData\Local\Programs\Python\Python37-32\lib\site-packages\openpyxl\chart\reader.py", line 50, in find_charts
drawing = SpreadsheetDrawing.from_tree(tree)