pyexcel / openpyxl __init__() 得到了一个意外的关键字参数 ERROR

pyexcel / openpyxl __init__() got an unexpected keyword argument ERROR

我在尝试将文件上传回我们的应用程序时收到以下错误堆栈。该应用程序获取 xlsx 表格并能够解析它们并将内容上传回 SalesForce。我对这个问题做了一些深入研究,看起来它可能与 openpyxl 在兼容性方面有关,但我不是 100% 确定。似乎其他人也遇到了这个问题,但似乎没有列出任何解决方案。还有其他人遇到过这个问题吗?

load_workbook error for 1707 version excel & pip install/upgrade error openpyxl

https://bitbucket.org/openpyxl/openpyxl/issues/636/error-when-loading-outlookcom-web-excel

 Traceback (most recent call last):
   File "/usr/lib/python2.6/site-packages/flask/app.py", line 1817, in wsgi_app
     response = self.full_dispatch_request()
   File "/usr/lib/python2.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
     rv = self.handle_user_exception(e)
   File "/usr/lib/python2.6/site-packages/flask/app.py", line 1381, in handle_user_exception
     reraise(exc_type, exc_value, tb)
   File "/usr/lib/python2.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
     rv = self.dispatch_request()
   File "/usr/lib/python2.6/site-packages/flask/app.py", line 1461, in dispatch_request
     return self.view_functions[rule.endpoint](**req.view_args)
   File "/var/www/html/nurfi/run.py", line 139, in upload_file
     responses = upload_nurfi_files(files_to_upload)
   File "/var/www/html/nurfi/nurfinstein.py", line 134, in upload_nurfi_files
     statuses[filename] = upload_sheet(file_, sf, verbose_mode = False )
   File "/var/www/html/nurfi/nurfi_app/upload/upload_nurfi.py", line 74, in upload_sheet
     book_dict = pyexcel.get_book_dict(file_name = workbook_name)
   File "/usr/lib/python2.6/dist-packages/pyexcel/core.py", line 343, in get_book_dict
     book = get_book(**keywords)
   File "/usr/lib/python2.6/dist-packages/pyexcel/core.py", line 118, in get_book
     book_stream = _get_book(**keywords)
   File "/usr/lib/python2.6/dist-packages/pyexcel/core.py", line 137, in _get_book
     sheets = source.get_data()
   File "/usr/lib/python2.6/dist-packages/pyexcel/sources/file_source_input.py", line 52, in get_data
     sheets = get_data(self.file_name, streaming=True, **self.keywords)
   File "/usr/lib/python2.6/dist-packages/pyexcel_io/io.py", line 31, in get_data
     file_type=file_type, **keywords)
   File "/usr/lib/python2.6/dist-packages/pyexcel_io/io.py", line 120, in load_data_new
     reader.open(file_name, **keywords)
   File "/usr/lib/python2.6/dist-packages/pyexcel_xlsx/xlsx.py", line 87, in open
     self._load_from_file()
   File "/usr/lib/python2.6/dist-packages/pyexcel_xlsx/xlsx.py", line 127, in _load_from_file
     data_only=True)
   File "/usr/lib/python2.6/dist-packages/openpyxl/reader/excel.py", line 234, in load_workbook
     parser.parse()
   File "/usr/lib/python2.6/dist-packages/openpyxl/reader/worksheet.py", line 106, in parse
     dispatcher[tag_name](element)
   File "/usr/lib/python2.6/dist-packages/openpyxl/reader/worksheet.py", line 295, in parse_data_validation
     dv = DataValidation.from_tree(node)
   File "/usr/lib/python2.6/dist-packages/openpyxl/descriptors/serialisable.py", line 78, in from_tree
     return cls(**attrib)
 TypeError: __init__() got an unexpected keyword argument '{http://schemas.microsoft.com/office/spreadsheetml/2014/revision}uid'

所以希望我花时间挖掘这个可以节省一些其他人的时间。看来这个问题可以通过将 openpyxl 及其依赖插件 openpyxl_xlsx 更新到最新版本来解决。如果您正在使用 pyexcel 将其更新到最新的包,我也会推荐,我相信它使用 openpyxl 作为依赖项。

sudo pip install openpyxl --upgrade
sudo pip install openpyxl_xlsx --upgrade
sudo pip install pyexcel --upgrade

或特定版本...

sudo pip install --upgrade 'package-name'==0.0.0 (Version Number)