problem using pickle / cPickle

Vojin Jovanovic vjovanovic at houston.rr.com
Sat Jan 3 00:25:11 EST 2004


Try it in Python 2.2.

"Jesse Bloom" <bloom at caltech.edu> wrote in message
news:3FF5CB56.4000309 at caltech.edu...
> I keep running into a problem when I use pickle or cPickle to unpickle a
> python object I have serialized from the database.  I read the string
> for the serialized object.  Apparently I am missing an argument?  Here's
> what happens:
>
> cPickle.loads(s)
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> TypeError: __new__() takes exactly 2 arguments (1 given)
>
> Same thing happens when I use pickle:
>
>  >>> pickle.loads(s)
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "/usr/local/lib/python2.3/pickle.py", line 1394, in loads
>      return Unpickler(file).load()
>    File "/usr/local/lib/python2.3/pickle.py", line 872, in load
>      dispatch[key](self)
>    File "/usr/local/lib/python2.3/pickle.py", line 1097, in load_newobj
>      obj = cls.__new__(cls, *args)
> TypeError: __new__() takes exactly 2 arguments (1 given)
>





More information about the Python-list mailing list