nixpy icon indicating copy to clipboard operation
nixpy copied to clipboard

creating empty property fails

Open jgrewe opened this issue 9 years ago • 4 comments

the following code works:

section.create_property("test", None)

this version fails with an assert error which cannot be caught:

section.create_property("test", [])

I guess we should allow this.

jgrewe avatar Feb 18 '16 12:02 jgrewe

On a similar note, the same assertion error is triggered when trying to store an empty nix.Value.

>>> nix.Value()
Value{[Nothing] }
>>> section.create_property("test", nix.Value())
... nix/backend/hdf5/PropertyHDF5.cpp:305: static nix::hdf5::h5x::DataType nix::hdf5::PropertyHDF5::fileTypeForValue(nix::DataType): Assertion `false' failed.

I'd expect since an empty (Nothing) value is supported by nix.Value, that at least that would be supported as a property, even if None were not supported.

achilleas-k avatar Feb 18 '16 13:02 achilleas-k

@achilleas-k problem is, what would be the type of the underlying property, i.e. the type of the DataSet in HDF5 holding the property? Catching the error earlier is of course needed.

gicmo avatar Feb 18 '16 20:02 gicmo

Right, no null-type in the backend. Understandable. By catching the error earlier, do you mean removing Value{[Nothing] } so that the error is caught on creation of the property value?

achilleas-k avatar Feb 18 '16 21:02 achilleas-k

Empty properties can be created if a dtype is specified.

E.g.,

sec.create_property("empty", values_or_dtype=nix.DataType.String)

Should we close this?

achilleas-k avatar May 21 '19 12:05 achilleas-k