Error when calling VOL using h5py


I implemented a VOL using HDF5 1.14.0 and it works well for C++. Now I’m trying to call it by h5py lib. When I’m trying to open a dataset using dset = f['test']. It gives an error “RuntimeError: Can’t retrieve file id (can’t wrap object)”.

It seems the problems lie in the VOL functions of H5VLobject_open() and H5VLobject_get(). From my understanding, these two functions may help recognize the extra info of opened objects (e.g. dataset or group) as h5py opens objects implicitly (not like H5DOpen in C++). So I simply passed the type H5I_DATASET to H5VLobject_open’s *opened_type and passed the name of dataset into H5VLobject_get’s H5VL_object_get_args_t *args. But it still doesn’t solve the problem.

It looks like the specific error you encountered happened due to a failure during the ‘wrap object’ callback in the VOL - see here. You may want to check how the VOL’s wrap callback is implemented.

That being said, h5py itself has limited compatibility with VOL connectors - it uses the HDF5 1.10 API, and the VOL layer was added in 1.12 and heavily modified in 1.14. API functions for which h5py uses pre-1.12 versions (e.g. H5Ovisit) will likely run into errors.

Thanks for the quick response. Yeah, I didn’t implement the wrap callback. Let me try that.

The problem is solved.