[yt-users] Pickle vs. _type_name
Matthew Turk
matthewturk at gmail.com
Mon Jun 17 10:34:41 PDT 2013
Hi Dave,
I think it needs the following items:
_con_args = ("base_region", "field_cuts")
_type_name = "cut_region"
in the class definition and I think it should be good to go.
-Matt
On Mon, Jun 17, 2013 at 1:32 PM, David Collins <dcollins4096 at gmail.com> wrote:
> Hi, all--
>
> I'm trying to pickle a dataset I made with cut_region. This fails on the
> call to __reduce__ since the cut_region doesn't have a _type_name attribute.
> Is there an easy way to give _type_names to cut regions in general, or
> should I clone the __reduce__ method for InLineExtractedRegionBase?
>
> I generate the object like this:
>
>>> region = pf.h.region(Center,Left,Right)
>>> cut_region = region.cut_region(['grid[some_field] == some_value'})
>>> file = open(args)
>>> cPickle.dump(cut_region,file)
>
> which gives the following error:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/nics/b/home/collins/yt2.0/fPickle.py", line 15, in dump
> output = cPickle.dump(object,file,*args,**kwargs)
> File
> "/nics/b/home/collins/local_2013_03_12/src/yt-dave/yt/data_objects/data_containers.py",
> line 407, in __reduce__
> [getattr(self, n) for n in self._con_args] +
> AttributeError: 'InLineExtractedRegionBase' object has no attribute
> '_type_name'
>
>
> Thanks!
> d.
>
> _______________________________________________
> 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