TypeError: expected <class 'openpyxl.styles.fills.Fill'>
`python class Fill(Serialisable):
"""Base class"""
tagname = "fill"
@classmethod
def from_tree(cls, el):
children = [c for c in el]
if not children:
return
child = children[0]
if "patternFill" in child.tag:
return PatternFill._from_tree(child)
return super(Fill, GradientFill).from_tree(child)
python
def _convert(expected_type, value):
"""
Check value is of or can be converted to expected type.
"""
if not isinstance(value, expected_type):
try:
value = expected_type(value)
except:
raise TypeError('expected ' + str(expected_type))
return value
`
在from_tree返回None时,_convert没有办法实现Fill的init,Fill没有__init__方法