Bilal The error message is "No such file or directory". Are you sure the file name is correct? Can you "ls" the file? Can you run "h5ls" on it to display the contents?
-erik On Tue, Sep 1, 2020 at 9:11 AM Bilal Hameed <[email protected]> wrote: > > Dear Users, > > I am trying to open a .h5 file in jupyter-notebook. Please anyone guide me > about reading of HDF files. > > Command; > > > import h5py > filename = "ct_multilevel-err.h5" > with h5py.File(filename, "r") as f: > # List all groups > print("Keys: %s" % f.keys()) > a_group_key = list(f.keys())[0] > > # Get the data > data = list(f[a_group_key]) > > Error; > > IOError Traceback (most recent call last) > <ipython-input-12-769b4593257a> in <module>() > 1 filename = "ct_multilevel-err.h5" > ----> 2 with h5py.File(filename, "r") as f: > 3 # List all groups > 4 print("Keys: %s" % f.keys()) > 5 a_group_key = list(f.keys())[0] > > /usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc in __init__(self, > name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, > rdcc_w0, track_order, **kwds) > 406 fid = make_fid(name, mode, userblock_size, > 407 fapl, > fcpl=make_fcpl(track_order=track_order), > --> 408 swmr=swmr) > 409 > 410 if isinstance(libver, tuple): > > /usr/local/lib/python2.7/dist-packages/h5py/_hl/files.pyc in make_fid(name, > mode, userblock_size, fapl, fcpl, swmr) > 171 if swmr and swmr_support: > 172 flags |= h5f.ACC_SWMR_READ > --> 173 fid = h5f.open(name, flags, fapl=fapl) > 174 elif mode == 'r+': > 175 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl) > > h5py/_objects.pyx in h5py._objects.with_phil.wrapper() > > h5py/_objects.pyx in h5py._objects.with_phil.wrapper() > > h5py/h5f.pyx in h5py.h5f.open() > > IOError: Unable to open file (unable to open file: name = > 'ct_multilevel-err.h5', errno = 2, error message = 'No such file or > directory', flags = 0, o_flags = 0) > > _______________________________________________ > Users mailing list > [email protected] > http://lists.einsteintoolkit.org/mailman/listinfo/users -- Erik Schnetter <[email protected]> http://www.perimeterinstitute.ca/personal/eschnetter/ _______________________________________________ Users mailing list [email protected] http://lists.einsteintoolkit.org/mailman/listinfo/users
