Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python 2.6 cPickle.load results in EOFError

I use cPickle to pickle a list of integers, using HIGHEST_PROTOCOL,

cPickle.dump(l, f, HIGHEST_PROTOCOL)

When I try to unpickle this using the following code, I get an EOFError. I tried 'seeking' to offset 0 before unpickling, but the error persists.

l = cPickle.load(f)

Any ideas?

like image 728
fsm Avatar asked Feb 02 '10 20:02

fsm


1 Answers

If you are on windows, make sure you

open(filename, 'wb') # for writing
open(filename, 'rb') # for reading
like image 197
John La Rooy Avatar answered Nov 13 '22 16:11

John La Rooy