[Grok-dev] pickling of dynamic classes

Anurag Sharma a.sharma at chintan.in
Wed May 16 11:24:30 UTC 2012

Dear All,

This seems to be generally a problem with pickle but I hope I will be able
to get some inputs for the problem.

In one function of my grok.Application class I'm dynamically creating a

self.VarName = type('class name', (<base class>,), dict())
* <base class> does inherit grok.Container.*

While running this I'm getting following error:

Module ZODB.serialize:*422* in serialize
>>  <http://localhost:8080/bizopine#>*return* self*.*_dump*(*meta*,* obj*.*
Module ZODB.serialize:*431* in _dump        <http://localhost:8080/bizopine#>
>>  <http://localhost:8080/bizopine#>self*.*_p*.*dump*(*state*)*
*PicklingError: Can't pickle <class '<appname>.app.<class name>'>:
attribute lookup **<appname>.app.<class name>** failed*

Pickling documentation does say that :
What can be pickled and unpickledclasses that are defined at the top level
of a module

*But is it the problem here and if yes then what can be the possible
solution for this ?*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/grok-dev/attachments/20120516/e28cc95f/attachment.html>

More information about the Grok-dev mailing list