diff --git a/src/caosadvancedtools/cfoods/h5.py b/src/caosadvancedtools/cfoods/h5.py index 543ac327871fb7f5c79d68e638af1a47b62d83f6..33f8751048b8d4f7a40b8fdb10e1ad8246177029 100644 --- a/src/caosadvancedtools/cfoods/h5.py +++ b/src/caosadvancedtools/cfoods/h5.py @@ -85,13 +85,13 @@ def h5_attr_to_property(val): if isinstance(val, np.ndarray): if val.ndim > 1: return None, None - - if val.ndim == 0: - raise NotImplementedError( - "Code assumes that scalar values " - "will not be given as np.ndarray objects") - val = list(val) + # The tolist method is on both numpy.ndarray and numpy.generic + # and properly converts scalars (including 0-dimensional + # numpy.ndarray) to Python scalars and 1D arrays to lists of + # Python scalars. + if val.ndim != 0: dtype = db.LIST(dtype) + val = val.tolist() # TODO this can eventually be removed