First post, recursive references with pickle.

Discussion in 'Python' started by mark starnes, Nov 10, 2008.

  1. mark starnes

    mark starnes Guest

    Hi everyone, this is my first post to this group, so please be gentle.

    I've written a class which, when I attempt to pickle, gives the error:

    *** RuntimeError: maximum recursion depth exceeded

    Is there a way to make pickle display data about what it's trying
    to do? I'm thinking that if so, the recursive component will be
    immediately visible, easing the bug hunt.

    Any help would be appreciated.

    BR,

    Mark.
    mark starnes, Nov 10, 2008
    #1
    1. Advertising

  2. On Nov 10, 2:23 pm, mark starnes <> wrote:

    > Hi everyone, this is my first post to this group, so please be gentle.
    >
    > I've written a class which, when I attempt to pickle, gives the error:
    >
    > *** RuntimeError: maximum recursion depth exceeded
    >
    > Is there a way to make pickle display data about what it's trying
    > to do?  I'm thinking that if so, the recursive component will be
    > immediately visible, easing the bug hunt.
    >
    > Any help would be appreciated.


    How about commenting out one by one the attributes of the object
    you're trying to pickle until you find the problematic one(s) ?
    Something like:

    class MyClass(object):
    ...
    def __getstate__(self):
    del self.foo
    return self.__dict__

    Then do the same to the class of self.foo, and so on recursively,
    until you find the real culprit.

    HTH,
    George
    George Sakkis, Nov 10, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. a pickle's pickle

    , Aug 2, 2005, in forum: Python
    Replies:
    4
    Views:
    364
  2. Replies:
    2
    Views:
    304
  3. n00m
    Replies:
    12
    Views:
    1,094
  4. Michele Simionato
    Replies:
    2
    Views:
    1,854
    Michele Simionato
    May 23, 2008
  5. vamsi
    Replies:
    21
    Views:
    2,033
    Keith Thompson
    Mar 9, 2009
Loading...

Share This Page