You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assume that there is a cell with type attribute set to date, which has no value. During the conversion, TypeError gets thrown by the strptime() function, as the value of passed argument self._cell.value is None, rather than a string, which is expected.
Here is the traceback:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
yield
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 615, in run
testMethod()
File "/Users/exer2k/code/xml2xlsx/tests/__init__.py", line 169, in test_cell_type_date
sheet = io.BytesIO(xml2xlsx(template))
File "/Users/exer2k/code/xml2xlsx/xml2xlsx/__init__.py", line 237, in xml2xlsx
return etree.XML(xml, parser, )
File "src/lxml/etree.pyx", line 3213, in lxml.etree.XML
File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1757, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1068, in lxml.etree._BaseParser._parseUnicodeDoc
File "src/lxml/parsertarget.pxi", line 192, in lxml.etree._TargetParserContext._handleParseResultDoc
File "src/lxml/parsertarget.pxi", line 180, in lxml.etree._TargetParserContext._handleParseResultDoc
File "src/lxml/etree.pyx", line 318, in lxml.etree._ExceptionContext._raise_if_stored
File "src/lxml/saxparser.pxi", line 485, in lxml.etree._handleSaxEnd
File "src/lxml/parsertarget.pxi", line 99, in lxml.etree._PythonSaxParserTarget._handleSaxEnd
File "/Users/exer2k/code/xml2xlsx/xml2xlsx/__init__.py", line 216, in end
self._cell.value, self._cell_date_format).date()
TypeError: strptime() argument 1 must be str, not None
This can be asserted with the following unit test:
Instead, the script should catch this, leave the cell empty, and continue with the execution. It is a simple fix, and I can provide a pull request if you accept them.
The text was updated successfully, but these errors were encountered:
Assume that there is a cell with
type
attribute set todate
, which has no value. During the conversion,TypeError
gets thrown by thestrptime()
function, as the value of passed argumentself._cell.value
isNone
, rather than a string, which is expected.Here is the traceback:
This can be asserted with the following unit test:
Instead, the script should catch this, leave the cell empty, and continue with the execution. It is a simple fix, and I can provide a pull request if you accept them.
The text was updated successfully, but these errors were encountered: