Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Troubleshooting pickle errors

Reply
Thread Tools

Troubleshooting pickle errors

 
 
Jean-Luc
Guest
Posts: n/a
 
      04-02-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pickle error: can't pickle instancemethod objects Michele Simionato Python 2 05-23-2008 08:29 AM
a pickle's pickle temposs@gmail.com Python 4 08-02-2005 07:20 PM
troubleshooting multiple inheritance errors Jonathan Brandmeyer Python 0 09-11-2004 08:06 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
Troubleshooting errors on 2950G interface, need help Ole Vik Cisco 3 11-05-2003 01:57 PM



Advertisments