By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,525 Members | 1,634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,525 IT Pros & Developers. It's quick & easy.

First post, recursive references with pickle.

P: n/a
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.
Nov 10 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Nov 10, 2:23*pm, mark starnes <m.starne...@imperial.ac.ukwrote:
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
Nov 10 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.