First post, recursive references with pickle.

M

mark starnes

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

George Sakkis

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top