Cannot load file due to double TypeError

Issue #895 resolved
Robert Howlett created an issue

When attempting to load the attached file with attached script I get a TypeError.

Python Version 3.6.0

Openpyxl version 2.5.0a3

Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 57, in _convert
    value = expected_type(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Projects/gift_for_openpyxl/", line 14, in <module>
  File "C:/Projects/gift_for_openpyxl/", line 8, in do_thing
    wb = openpyxl.load_workbook(xls)  # TypeError: expected <class 'int'>
  File "C:\Python36\lib\site-packages\openpyxl\reader\", line 274, in load_workbook
    for c in find_charts(archive,
  File "C:\Python36\lib\site-packages\openpyxl\chart\", line 52, in find_charts
    cs = get_rel(archive, deps,, ChartSpace)
  File "C:\Python36\lib\site-packages\openpyxl\packaging\", line 158, in get_rel
    obj = cls.from_tree(tree)
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 83, in from_tree
    obj = desc.expected_type.from_tree(el)
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 99, in from_tree
    return cls(**attrib)
  File "C:\Python36\lib\site-packages\openpyxl\chart\", line 191, in __init__
    self.fmtId = fmtId
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 36, in __set__
    super(Nested, self).__set__(instance, value)
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 69, in __set__
    value = _convert(self.expected_type, value)
  File "C:\Python36\lib\site-packages\openpyxl\descriptors\", line 59, in _convert
    raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'int'>

Comments (2)

  1. Ben Lloyd-Hughes

    Many thanks for the fix! [Not to mention your really helpful work in general :) ] Would it be possible to bump the pypi version upto 2.5.0b1 ? It would make specifying the requirement much cleaner on a project where I need the fix.

  2. Log in to comment