diff --git a/doc/source/changes/version_0_35_1.rst.inc b/doc/source/changes/version_0_35_1.rst.inc index 0066145..c3ea7c6 100644 --- a/doc/source/changes/version_0_35_1.rst.inc +++ b/doc/source/changes/version_0_35_1.rst.inc @@ -69,6 +69,9 @@ Fixes * do not try to display Path objects which point to a file or directory which does not exist (closes :editor_issue:`317`). +* fixed (Excel) Sheet objects being only partially displayed when + the first value contains a number but other values contain text. + * fixed the mechanism writing warning/error messages happening during the editor initialization. The errors are now correctly written in the user TEMP directory / larray-editor-stderr.log \ No newline at end of file diff --git a/larray_editor/arrayadapter.py b/larray_editor/arrayadapter.py index 1a0a34a..97db2ac 100644 --- a/larray_editor/arrayadapter.py +++ b/larray_editor/arrayadapter.py @@ -1805,8 +1805,11 @@ def open(cls, fpath): def close(self): self.data.close() - -none_to_empty_string = np.vectorize(lambda v: v if v is not None else '') +# we need to specify otypes explicitly here because otherwise np.vectorize +# will use the type of the first value (e.g. int64) for the resulting array and that breaks if it +# cannot hold subsequent values +none_to_empty_string = np.vectorize(lambda v: v if v is not None else '', + otypes=[object]) @adapter_for('larray.inout.xw_excel.Sheet') @@ -2848,6 +2851,8 @@ class PyTablesFileAdapter(AbstractColumnarAdapter): _COLNAMES = ['Name'] def __init__(self, data, attributes): + if not data.isopen: + raise ValueError('file is already closed') super().__init__(data=data, attributes=attributes) def shape2d(self):