fsm
fsm

Reputation: 407

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?

Upvotes: 11

Views: 8514

Answers (1)

John La Rooy
John La Rooy

Reputation: 304137

If you are on windows, make sure you

open(filename, 'wb') # for writing
open(filename, 'rb') # for reading

Upvotes: 20

Related Questions