problem using pickle / cPickle

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jesse Bloom

    problem using pickle / cPickle

    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:
    [color=blue][color=green][color=darkred]
    >>> pickle.loads(s)[/color][/color][/color]
    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)

  • Vojin Jovanovic

    #2
    Re: problem using pickle / cPickle

    Try it in Python 2.2.

    "Jesse Bloom" <bloom@caltech. edu> wrote in message
    news:3FF5CB56.4 000309@caltech. edu...[color=blue]
    > 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:
    >[color=green][color=darkred]
    > >>> pickle.loads(s)[/color][/color]
    > 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)
    >[/color]


    Comment

    Working...