Created
March 17, 2015 01:14
-
-
Save andresriancho/15b5e226de68a0c2efd0 to your computer and use it in GitHub Desktop.
Pickle debug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug_pickle(instance): | |
""" | |
:return: Which attribute from this object can't be pickled? | |
""" | |
attribute = None | |
for k, v in instance.__dict__.iteritems(): | |
try: | |
cPickle.dumps(v) | |
except: | |
attribute = k | |
break | |
return attribute |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version for Python3