Can't pickle objects in acquisition wrappers
Greetings Zopistas! I'm returning to Zope after about a year away and am working on a project that i have pieced together over about 4 years. I recently deployed this project (a family history web site) under a zope 2.7.x install (it used to run on a 2.4.x install) and now I can't seem to update any of my objects. when i try to save them, I get a TypeError: Can't pickle objects in acquisition wrappers. I was never more than a dabbler, so I can't really claim to fully grok what acquisition wrappers are, other than being a construct that allows me to refer to an object in a request without knowing exactly where it is (ie is it a request parameter, a member of my object etc). Googling for this message yields very little information and grepping the source code yields one nondescript (at least to me) line in _Acquisition.c . Does anyone understand what this error means? Does anyone have any ideas on how to tell what "acquisition wrapper" i'm saving? Is there a way for me to workaround this? Many thanks, Keith R. Alperin
At Monday 19/12/2005 00:53, Keith Alperin wrote:
I'm returning to Zope after about a year away and am working on a project that i have pieced together over about 4 years. I recently deployed this project (a family history web site) under a zope 2.7.x install (it used to run on a 2.4.x install) and now I can't seem to update any of my objects. when i try to save them, I get a TypeError: Can't pickle objects in acquisition wrappers. I was never
You should not store a persistent attribute that is an acquisition wrapper itself. (What is that... see the corresponing chapter in the Zope Developers Guide). You are developing your own Product, I presume? Perhaps, you are keeping a direct reference to another persistent object? You should store its id instead, o use a container like ObjectManager. Without more information that's all I can guess... Gabriel Genellina Softlab SRL
This is almost definitely my problem as my products keep direct references to other persistent objects all of the time. Out of curiosity, has this always been a poor practice or is it something that changed recently? Many thanks Gabriel (and others). Keith On Dec 18, 2005, at 11:00 PM, Gabriel Genellina wrote:
At Monday 19/12/2005 00:53, Keith Alperin wrote:
I'm returning to Zope after about a year away and am working on a project that i have pieced together over about 4 years. I recently deployed this project (a family history web site) under a zope 2.7.x install (it used to run on a 2.4.x install) and now I can't seem to update any of my objects. when i try to save them, I get a TypeError: Can't pickle objects in acquisition wrappers. I was never
You should not store a persistent attribute that is an acquisition wrapper itself. (What is that... see the corresponing chapter in the Zope Developers Guide). You are developing your own Product, I presume? Perhaps, you are keeping a direct reference to another persistent object? You should store its id instead, o use a container like ObjectManager. Without more information that's all I can guess...
Gabriel Genellina Softlab SRL
On 19 Dec 2005, at 18:07, Keith Alperin wrote:
This is almost definitely my problem as my products keep direct references to other persistent objects all of the time.
Out of curiosity, has this always been a poor practice or is it something that changed recently?
It's always been poor practice. jens
At Monday 19/12/2005 15:07, Keith Alperin wrote:
This is almost definitely my problem as my products keep direct references to other persistent objects all of the time.
Out of curiosity, has this always been a poor practice or is it something that changed recently?
Not sure when started to be checked, but has never been a good practice, at least because the memory leak it produces (circular references). Gabriel Genellina Softlab SRL
Keith Alperin wrote:
I'm returning to Zope after about a year away and am working on a project that i have pieced together over about 4 years. I recently deployed this project (a family history web site) under a zope 2.7.x install (it used to run on a 2.4.x install) and now I can't seem to update any of my objects. when i try to save them, I get a TypeError: Can't pickle objects in acquisition wrappers. I was never more than a dabbler, so I can't really claim to fully grok what acquisition wrappers are, other than being a construct that allows me to refer to an object in a request without knowing exactly where it is (ie is it a request parameter, a member of my object etc). Googling for this message yields very little information and grepping the source code yields one nondescript (at least to me) line in _Acquisition.c . Does anyone understand what this error means? Does anyone have any ideas on how to tell what "acquisition wrapper" i'm saving? Is there a way for me to workaround this?
In your traceback you should have a call like p.dump(state). Go edit this file it's in and replace it with code like: try: p.dump(state) except TypeError, e: raise TypeError(str(e)+': '+repr(state)) This will give you more info about what fails to be pickled. Any part of the error where you see a full path (like <File 0x12345 at /some/site/foo>) is with an acquisition wrapper. It shouldn't. Or you can add a import pdb; pdb.set_trace() there if you know how to use PDB. Florent -- Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D +33 1 40 33 71 59 http://nuxeo.com fg@nuxeo.com
participants (4)
-
Florent Guillaume -
Gabriel Genellina -
Jens Vagelpohl -
Keith Alperin