Problems with h5py after update

Hi, i was using h5py to access a specific dataset that is not yet supported by the HDF5 module.
until lately, i was able to use

  f = h5py.File(filename, "r")
  aqLog = f["AcquisitionLog"]["Log"]
  logEntryDescription = aqLog[1][3]

Now it seems that h5py.File returns a Dict instead of a file handle and does not have a .close() anymore. I get

KeyError: key :close not found
in getindex at base/dict.jl:688

the same for f.close() or close(f).

Did something change in Julia or is it a h5py issue? It’s not a problem if you want to open just one file, but after several thousands I get the error now that too many files are open.
How can I close files opened with h5py.File() ?
Thanks, Lukas


It would help if you could provide a minimal reproducible example. Which versions of everything are you using?

Have you reported an issue to the relevant Julia package to include the necessary functionality? Which is what, exactly?

Here I attached a zipped HDF5 file which can be read by the posted code fragment, if you have installed PyCall and the hdf5 lib.
The problem is a very general one, the file object of the python lib seems to get converted into a Julia Dictionary, and this does not contain the close() method anymore. Reading contents is not even necessary to reproduce, I just can’t find a way to close a file opened with fid = h5py.File(filename, “r”) anymore.

The version I am using is:
Julia: v"0.5.0"
PyCall: 1.11.0

An issue is already reported in the HDF5 library GitHub - JuliaIO/HDF5.jl: Save and load data in the HDF5 file format from Julia at
There is also a file attached to reproduce why I can’t use the native Julia lib.

1 Like