Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unspecified error in H5DSiterate_scales when working with anonymous scale #2412

Open
FreddieWitherden opened this issue Apr 17, 2024 · 0 comments

Comments

@FreddieWitherden
Copy link

Consider the following snippet:

import h5py
import numpy as np

with h5py.File('test.h5', 'w') as f:
    d = f.create_dataset('data', (200, 100), dtype=float)
    t = f.create_dataset(None, (200,), dtype=float)

    d[:] = 0
    t[:] = np.arange(200)
    
    t.make_scale('t')
    d.dims[0].attach_scale(t)

with h5py.File('test.h5', 'r') as f:
    print(f['data'].dims[0][0])

where we create a dataset, an anonymous scale, and then attach this scale to the our named dataset. However, when we open the file up again we get:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[7], line 15
     12     d.dims[0].attach_scale(t)
     14 with h5py.File('test.h5', 'r') as f:
---> 15     print(f['data'].dims[0][0])

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File ~/Programming/pyfr-venv/lib/python3.11/site-packages/h5py/_hl/dims.py:68, in DimensionProxy.__getitem__(self, item)
     66 if isinstance(item, int):
     67     scales = []
---> 68     h5ds.iterate(self._id, self._dimension, scales.append, 0)
     69     return Dataset(scales[item])
     71 else:

File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()

File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()

File h5py/h5ds.pyx:167, in h5py.h5ds.iterate()

File h5py/defs.pyx:4516, in h5py.defs.H5DSiterate_scales()

RuntimeError: Unspecified error in H5DSiterate_scales (return value <0)

The relevant version info is:

Summary of the h5py configuration
---------------------------------

h5py    3.10.0
HDF5    1.14.3
Python  3.11.9 (main, Apr  6 2024, 07:27:31) [GCC 13.2.1 20240210]
sys.platform    linux
sys.maxsize     9223372036854775807
numpy   1.26.4
cython (built with) 0.29.37
numpy (built against) 1.23.2
HDF5 (built against) 1.14.3

I am unsure if this is an issue with h5py, HDF5, or user error on my part. If it is the latter, is there an easy way to catch these kinds of issues at the time the file is being written/closed rather than giving a quasi-broken file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant