[Yt-dev] h5py bug
Matthew Turk
matthewturk at gmail.com
Mon Apr 11 19:32:16 PDT 2011
Hi Stephen,
Yes, this errors out for me.
What it looks like is that the deallocation routine is being deferred.
HDF5 keeps a global state of files, and the order in which the
variable is dereferences, the file objects are closed, and the new
file is assigned is conflicting. In short, what I *think* is going
on, but which I may be wrong about:
h5py.File("whatever") is being evaluated.
Subsequently, it is assigned to variable 'f'
Then, as a result of this, the *old* variable 'f''s reference count
drops to zero. This calls the deallocation routine.
However, at this point, the file has been re-opened by a different variable.
This is all fixed if you use a different variable name for the second opening:
import h5py
f = h5py.File('test.h5')
f.close()
f2 = h5py.File('test.h5')
print f2['Grid00000001']['particle_position_x'][:]
f2.close()
If the variable goes out of scope, the same thing should work.
Additionally, the second 'del f' on line 881 of halo_objects should
not be necessary for this fix. Can you see if it is?
Perhaps more descriptive variable names (something I too am guilty of,
all too often) would obviate the need for all the del's.
-Matt
On Mon, Apr 11, 2011 at 10:22 PM, Stephen Skory <s at skory.us> wrote:
> Hi all,
>
>> I'll report it upstream if I can replicate it in a simple script. I'll
>> also give 1.2.1 a shot, which is also available. I'll let you know.
>
> After some testing, 1.2.1 does not fix the error. I've also found that
> a simple script like this will make the error:
>
> import h5py
> f = h5py.File('data0090.cpu0000')
> f.close()
> f = h5py.File('data0090.cpu0000')
> print f['Grid00000001']['particle_position_x'][:]
> f.close()
>
> Can someone try this on some data to see if they get the error too? Thanks!
>
>
> --
> Stephen Skory
> s at skory.us
> http://stephenskory.com/
> 510.621.3687 (google voice)
> _______________________________________________
> Yt-dev mailing list
> Yt-dev at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
>
More information about the yt-dev
mailing list