Debugging a pickle

Steve Holden steve at holdenweb.com
Wed Jun 7 22:20:32 EDT 2006


Jeffrey Barish wrote:
> I use cPickle to serialize some data so that I can read it back later.  It
> works sometimes, but other times I get an EOFError at the
> 
> data = cPickle.load(fileobj)
> 
> statement.  I assume that this error indicates that cPickle is not able to
> retrieve as much data from the file as it expects -- or that the dump did
> not write as much data as it should have.  Is that assumption correct?  Are
> there any debugging techniques I can use to figure out what is going wrong?

First of all, verify that you are opening the file in binary mode. Not 
doing this is the biggest cause of problems for Windows users, which the 
intermittent failure makes me suspect you may be.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Love me, love my blog  http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list