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

Pickling exception object works in 2.4 but not 2.5

P: n/a
In 2.5, this is what I get:

Python 2.5.2 (r252:60911, May 7 2008, 15:19:09)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>class Foo(Exception):
.... member = None
.... def __init__(self,member):
.... self.member=member
>>import cPickle
str = cPickle.dumps(Foo('testmember'))
f2 = cPickle.loads(str)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class
'__main__.Foo'>, ())
In 2.4 I don't get an error. Is there something I am doing wrong?

Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.