[yt-users] Pickle vs. _type_name

David Collins dcollins4096 at gmail.com
Mon Jun 17 10:32:49 PDT 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20130617/9cffbe43/attachment.htm>


More information about the yt-users mailing list