Oening file with empty Fill property cause TypeError
Calling function load_workbook
on file with empty Fill property in styles.xml cause error. Such file is properly opened by any version of MS Excell and older version of openpxl, but opening with current openpyxl cause following error. Example file is attached.
Traceback (most recent call last):
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\descriptors\base.py", line 55, in _convert
value = expected_type(value)
TypeError: Fill() takes no arguments
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.2.3\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "<input>", line 1, in <module>
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\reader\excel.py", line 317, in load_workbook
reader.read()
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\reader\excel.py", line 281, in read
apply_stylesheet(self.archive, self.wb)
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\styles\stylesheet.py", line 198, in apply_stylesheet
stylesheet = Stylesheet.from_tree(node)
File "C:\Users\dborzuc\viewe_python\lib\site-p[empty_Languages.xlsx](/uploads/d57a6c2cc9004e1f0c316074a1306b36/empty_Languages.xlsx)[empty_Languages.xlsx](/uploads/7bb11dc8c405ab9b1b12df67c4497629/empty_Languages.xlsx)ackages\openpyxl\styles\stylesheet.py", line 103, in from_tree
return super(Stylesheet, cls).from_tree(node)
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\descriptors\serialisable.py", line 103, in from_tree
return cls(**attrib)
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\styles\stylesheet.py", line 74, in __init__
self.fills = fills
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\descriptors\sequence.py", line 26, in __set__
seq = [_convert(self.expected_type, value) for value in seq]
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\descriptors\sequence.py", line 26, in <listcomp>
seq = [_convert(self.expected_type, value) for value in seq]
File "C:\Users\dborzuc\viewe_python\lib\site-packages\openpyxl\descriptors\base.py", line 57, in _convert
raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'openpyxl.styles.fills.Fill'>