[yt-users] Error saving clumps to the data file

Matthew Turk matthewturk at gmail.com
Mon Jan 21 03:50:46 PST 2013


Hi Andrew,

This looks to me like the pickle for your objects has a null
terminated string.  It's possible the newest h5py could fix this, or
that you could specify a string length when pickling to h5py, but the
easier solution might be to pickle the object to a file by itself:

import cPickle
cPIckle.dump(obj, open("my_file.cpkl", "wb"), protocol=-1)

Let us know if that works!

-Matt

On Sun, Jan 20, 2013 at 12:48 PM, Andrew Myers <atmyers at berkeley.edu> wrote:
> Dear yt users,
>
> I've generated some clumps, and would like to save them to look at later.
> When I try
>
> pf.h.save_object(master_clump, 'Clumps')
>
> I get the following error, which looks like it's coming fron hdf5. Has
> anybody seen this before?
>
> Thanks,
> Andrew
>
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> <ipython-input-13-0bda0f3d0b42> in <module>()
> ----> 1 pf.h.save_object(master_clump, 'Clumps')
>
> /indirect/o/atmyers/yt-x86_64/src/yt-hg/yt/data_objects/hierarchy.pyc in
> save_object(self, obj, name)
>     299         """
>     300         s = cPickle.dumps(obj, protocol=-1)
> --> 301         self.save_data(s, "/Objects", name, force = True)
>     302
>     303     def load_object(self, name):
>
> /indirect/o/atmyers/yt-x86_64/src/yt-hg/yt/data_objects/hierarchy.pyc in
> _save_data(self, array, node, name, set_attr, force, passthrough)
>     274         for q in node.split('/'):
>     275             if q: myGroup = myGroup.require_group(q)
> --> 276         arr = myGroup.create_dataset(name,data=array)
>     277         if set_attr is not None:
>     278             for i, j in set_attr.items(): arr.attrs[i] = j
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_hl/group.pyc in
> create_dataset(self, name, shape, dtype, data, **kwds)
>      69         """
>      70
> ---> 71         dsid = dataset.make_new_dset(self, shape, dtype, data,
> **kwds)
>      72         dset = dataset.Dataset(dsid)
>      73         if name is not None:
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_hl/dataset.pyc in
> make_new_dset(parent, shape, dtype, data, chunks, compression, shuffle,
> fletcher32, maxshape, compression_opts, fillvalue)
>      92
>      93     if data is not None:
> ---> 94         dset_id.write(h5s.ALL, h5s.ALL, data)
>      95
>      96     return dset_id
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/h5d.so in
> h5py.h5d.DatasetID.write (h5py/h5d.c:2866)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_proxy.so in
> h5py._proxy.dset_rw (h5py/_proxy.c:1766)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/defs.so in
> h5py.defs.H5Tconvert (h5py/defs.c:18439)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_errors.so in
> h5py._errors.set_exception (h5py/_errors.c:711)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_conv.so in
> h5py._conv.str2vlen (h5py/_conv.c:3382)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_conv.so in
> h5py._conv.generic_converter (h5py/_conv.c:1302)()
>
> /o/atmyers/yt-x86_64/lib/python2.7/site-packages/h5py/_conv.so in
> h5py._conv.conv_str2vlen (h5py/_conv.c:2158)()
>
> ValueError: VLEN strings do not support embedded NULLs
>
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list