Setting a cell value using some Python data types raises a TypeError.
Created originally on Bitbucket by joshayers (Josh Ayers)
When assigning a Python variable to a worksheet cell, certain NumPy and Python native data types raise a TypeError.
Here are the data types that cause the error: long, complex, numpy.int16, numpy.int64, numpy.float32.
I attached a file that demonstrates the error. I'm running Python 2.7.1 on Windows and OpenPyXL 1.5.2.
Here is the full error trace: Traceback (most recent call last): File "", line 1, in File "C:\Program Files (x86)\python27\lib\site-packages\openpyxl\cell.py", line 293, in _set_value self.bind_value(value) File "C:\Program Files (x86)\python27\lib\site-packages\openpyxl\cell.py", line 243, in bind_value self._data_type = self.data_type_for_value(value) File "C:\Program Files (x86)\python27\lib\site-packages\openpyxl\cell.py", line 233, in data_type_for_value elif self.RE_PATTERNS['numeric'].match(value): TypeError: buffer size mismatch
Attachments: openpyxl_TypeError.py