469,352 Members | 2,094 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Troubleshooting pickle errors

Hi

I am grafing pickling functionality on a big dictionary of object
instances and I am having numerous problems. I think understand the
notion of what can/can't be pickled and I know how to use __getstate__
/ __setstate__ to weed out offending references. But I am finding it
very hard to identify _which_ reference is causing exceptions like:

File "C:\UserApps\Python23\Lib\copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle function objects

PrettyPrinting the exception gets me:

{'args': ("can't pickle function objects",)}.

The exception includes no references to the guilty party! How do I
know _which_ object caused the issue? Though my current objects (i.e.
the stuff I am trying to pickle) are new, its instances hold
references to a lot of instances of existing utility classes of mine
that are database aware. I would not like to modify those utility
classes any more than I _have_ to since I use them elsewhere. I have
already stripped out database Connection references, as well as File
references. Those were obvious.

How do I identify the remaining issues? If I work with a smaller data
set, I often miss problems entirely, so reducing the pickling scope is
not an easy option to implement. The best I have managed so far is to
open the pickle file and look near the end, where the exception
presumably occurred. But I would expect there to be a more obvious
way to troubleshoot this stuff.

Cheers

JLuc
Jul 18 '05 #1
0 1089

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Guenter Walser | last post: by
2 posts views Thread by GMane Python | last post: by
4 posts views Thread by temposs | last post: by
reply views Thread by Mike P. | last post: by
reply views Thread by greg.landrum | last post: by
16 posts views Thread by John Salerno | last post: by
10 posts views Thread by crystalattice | last post: by
9 posts views Thread by tonyr1988 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.