(Apologies if this gets posted twice)
Someone reported a bug at the h5py issue tracker:
---
import h5py
# test setup
fid = h5py.File('test.hdf5', 'w')
g = fid.create_group('old_loc')
g2 = g.create_group('group')
d = g.create_dataset('dataset', data=0)
print "before move:"
print g2.name
print d.name
# now rename toplevel group
g.parent.id.move('old_loc', 'new_loc')
print "after move:"
# old parent remains in dataset name, group is ok
print g2.name
print d.name
# parent is accessed by name 'g' which does not exist any more
d.parent
fid.close()
---
That script produces the following output:
---
before move:
/old_loc/group
/old_loc/dataset
after move:
/new_loc/group
/old_loc/dataset
Traceback (most recent call last):
File "move_error.py", line 24, in <module>
d.parent
File
"/Users/darren/Library/Python/2.7/lib/python/site-packages/h5py/_hl/base.py",
line 144, in parent
return self.file[posixpath.dirname(self.name)]
File
"/Users/darren/Library/Python/2.7/lib/python/site-packages/h5py/_hl/group.py",
line 128, in __getitem__
oid = h5o.open(self.id, self._e(name), lapl=self._lapl)
File "h5o.pyx", line 176, in h5py.h5o.open (h5py/h5o.c:2814)
KeyError: "unable to open object (Symbol table: Can't open object)"
---
g.name and d.name simply return the result of h5i.get_name.
d.parent just splits d.name at the last "/" and returns the the first
part of the split.
g.parent.id.move calls H5Gmove2. I've read the warnings about
corrupting data using H5Gmove at
http://www.hdfgroup.org/HDF5/doc1.6/Groups.html#H5GUnlinkToCorrupt ,
but the situation described there does not appear to be relevant to
the problem we are seeing. Is h5py not performing the move properly,
or could this be a bug in HDF5?
Thanks,
Darren
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org