I got this error when I am trying to print the contents of the h5py file.
2
Traceback (most recent call last):
File "weight_save.py", line 25, in <module>
print f['/dest2'].value.ndim
oid = h5o.open(
self.id, self._e(name), lapl=self._lapl)
File "h5o.pyx", line 176, in h5py.h5o.open (h5py/h5o.c:2727)
KeyError: "unable to open object (Symbol table: Can't open object)"
Sample code:
import h5py
import numpy
def weight_save(path):
f = h5py.File(path + 'dset.h5', 'w')
f['/'+'dset1'] = numpy.zeros((6,4), dtype=numpy.int32)
f['/'+'dset2'] = numpy.zeros((6,4), dtype=numpy.int32)
f.close()
return None
weight_save(path)
f = h5py.File(path + 'dset.h5', 'r')
print f['/dset1'].value.ndim
print f['/dest2'].value.ndim #Error occurred at this line
Could any one help me to fix this error. Thanks in advance.
-----
Siva