[C++-sig] Re: Pickling object from nested class

David Abrahams dave at boost-consulting.com
Tue Oct 21 19:52:33 CEST 2003


Nikolay Mladenov <nickm at sitius.com> writes:

> Hi,
>
> I have class View with nested class Data  exported with BPL in module
> objects.
> When I try to pickle object of the nested class I get the following
> PicklingError:
>
>>>> dump(d,out)
> Traceback (most recent call last):
>   File "<console>", line 1, in ?
>   File "D:\Python22\Lib\pickle.py", line 973, in dump
>     Pickler(file, bin).dump(object)
>   File "D:\Python22\Lib\pickle.py", line 115, in dump
>     self.save(object)
>   File "D:\Python22\Lib\pickle.py", line 219, in save
>     self.save_reduce(callable, arg_tup, state)
>   File "D:\Python22\Lib\pickle.py", line 244, in save_reduce
>     save(callable)
>   File "D:\Python22\Lib\pickle.py", line 171, in save
>     self.save_global(object)
>   File "D:\Python22\Lib\pickle.py", line 519, in save_global
>     raise PicklingError(
> PicklingError: Can't pickle <class 'objects.Data'>: it's not found as
> objects.Data
>
> This worked with native Python classes.
> How can this be made to work?

Reproducible example, please.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list