cPickle alternative?

Tim Evans t.evans at paradise.net.nz
Sat Aug 16 13:52:04 CEST 2003

"Michael Peuser" <mpeuser at web.de> writes:

> Hi Drochem,
> (1) Your dataset seems to break the binary cPickle mode ;-) (I tried it with
> the "new Pickle" in 2.3 - same result: "EOF error" when loading back...) May
> be there is someone interested in fixing this ....
> > f=open ("test","w")
> > f=open ("test")

Note that on windows, you must open binary files using binary mode
when reading and writing them, like so:

    f = open('test', 'wb')
    f = open('test', 'rb')

If you don't do this binary data will be corrupted by the automatic
conversion of '\n' to '\r\n' by win32.  This is very likely what is
causing the above error.

Tim Evans

More information about the Python-list mailing list