G-Node / nixpy

Python library for NIX
https://readthedocs.org/projects/nixpy
Other
19 stars 26 forks source link

HDF5 RuntimeError on second+ level Section copy #527

Open mpsonntag opened 3 years ago

mpsonntag commented 3 years ago

Sections provide the copy_section() method (which is awesome by the way), that allows to copy whole section trees within a file or from one file to another.

Currently this only works with sections or section trees, that reside directly at the root of the file:

File
└ Section <- copy_section works

Sections that are at least one level deeper lead to an error (h5py/h5o.pyx in h5py.h5o.copy(): RuntimeError: Unable to copy object (component not found)) in the HDF5 library and cannot be copied.

File
└ Section
   └ Section  <- copy_section borks

Examples:

fname = "ishallruetheday.nix"
f = nixio.File.open(fname, nixio.FileMode.Overwrite)
sec = f.create_section("to.be.copied", "test")
sec.create_section("I.shant.be.copied", "test")
receive_sec = f.create_section("copy.receiver", "test")

# first level copy works
receive_sec.copy_section(f.sections["to.be.copied"])
# second level copy borks
receive_sec.copy_section(f.sections["to.be.copied"].sections["I.shant.be.copied"])