尝试将文件上传回我们的应用程序时,我收到以下错误堆栈。该应用程序采用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'
答案 0 :(得分:4)
所以希望我的时间挖掘这个节省了一些其他人的时间。看来这个问题可以通过将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)