DSM

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Can't pickle objects in acquisition wrappers

    5 answers - 1250 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    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
    Zope maillist - Zope (AT) zope (DOT) org
    ** No cross posts or HTML encoding! **
    (Related lists -
    )
  • No.1 | | 1130 bytes | |

    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 Manager.
    Without more information that's all I can guess

    Gabriel Genellina
    Softlab SRL

    Zope maillist - Zope (AT) zope (DOT) org

    ** No cross posts or HTML encoding! **
    (Related lists -

    )
  • No.2 | | 1630 bytes | |

    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.

    you can add a import pdb; pdb.set_trace() there if you know how to use PDB.

    Florent
  • No.3 | | 1488 bytes | |

    This is almost definitely my problem as my products keep direct
    references to other persistent objects all of the time.

    of curiosity, has this always been a poor practice or is it
    something that changed recently?

    Many thanks Gabriel (and others).

    Keith

    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 Manager.
    Without more information that's all I can guess
    --
    Gabriel Genellina
    Softlab SRL

    Zope maillist - Zope (AT) zope (DOT) org

    ** No cross posts or HTML encoding! **
    (Related lists -

    )
  • No.4 | | 468 bytes | |

    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.

    of curiosity, has this always been a poor practice or is it
    something that changed recently?

    It's always been poor practice.

    jens

    Zope maillist - Zope (AT) zope (DOT) org

    ** No cross posts or HTML encoding! **
    (Related lists -

    )
  • No.5 | | 675 bytes | |

    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.
    >

    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

    Zope maillist - Zope (AT) zope (DOT) org

    ** No cross posts or HTML encoding! **
    (Related lists -

    )

Re: Can't pickle objects in acquisition wrappers


max 4000 letters.
Your nickname that display:
In order to stop the spam: 2 + 1 =
QUESTION ON "DSM"

EMSDN.COM