cPickle and HIGHEST_PROTOCOL problems

S

Simon Dahlbacka

I'm trying to cache some information using cPickle
and I thought that using cPickle.HIGHEST_PROTOCOL would give me an
efficient representation.

However,

when trying to load the information back I just keep getting a broken
pickle with EOF error from cPicle.load(file('myfile.pickle','r'))

if I am not using cPickle.HIGHEST_PROTOCOL or -1 or 2 it seems to
work nicely, is this a bug or something else? (python 2.3.2 on winxp)

the information to be pickled is a dictionary of some strings and a
list of custom objects defined as:

class ErrorCode(object):
__slots__ = ['Name','Description']

def __init__(self, Name=None, Description=None):
self.Name = Name
self.Description = Description
def __getstate__(self):
return {"Name":Name, "Description":Description}
def __setstate__(self, dict):
Name = dict['Name']
Description = dict['Description']
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top