[yt-dev] Opening, closing, re-opening HDF5 files
John ZuHone
jzuhone at gmail.com
Mon Dec 10 16:27:30 PST 2012
Hi all,
I've got a problem I'm trying to solve regarding HDF5, and I've found it's specifically related to yt.
This sequence works:
f = h5py.open(filename, "r")
do stuff with f
f.close()
f = h5py.open(filename, "r+")
However, this sequence does not:
pf = load(filename)
do stuff with the pf
pf._handle.close()
del pf
f = h5py.open(filename, "r+")
It results in this:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-8-186261e4952a> in <module>()
----> 1 f = h5py.File("desktop_stuff/GasSloshing/GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150", "r+")
NameError: name 'h5py' is not defined
In [9]: import h5py
In [10]: f = h5py.File("desktop_stuff/GasSloshing/GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150", "r+")
---------------------------------------------------------------------------
IOError Traceback (most recent call last)
<ipython-input-10-186261e4952a> in <module>()
----> 1 f = h5py.File("desktop_stuff/GasSloshing/GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150", "r+")
/Users/jzuhone/yt-x86_64/lib/python2.7/site-packages/h5py/_hl/files.pyc in __init__(self, name, mode, driver, libver, **kwds)
148 pass
149 fapl = make_fapl(driver,libver,**kwds)
--> 150 fid = make_fid(name, mode, fapl)
151 Group.__init__(self, fid)
152 self._shared.lcpl = make_lcpl()
/Users/jzuhone/yt-x86_64/lib/python2.7/site-packages/h5py/_hl/files.pyc in make_fid(name, mode, plist)
45 fid = h5f.open(name, h5f.ACC_RDONLY, fapl=plist)
46 elif mode == 'r+':
---> 47 fid = h5f.open(name, h5f.ACC_RDWR, fapl=plist)
48 elif mode == 'w-':
49 fid = h5f.create(name, h5f.ACC_EXCL, fapl=plist)
/Users/jzuhone/yt-x86_64/lib/python2.7/site-packages/h5py/h5f.so in h5py.h5f.open (h5py/h5f.c:1618)()
IOError: unable to open file (File accessability: Unable to open file)
Anyone have any ideas?
Best,
John Z
More information about the yt-dev
mailing list