unpickling an NT object in Solaris?

Tim Peters tim_one at email.msn.com
Fri Apr 23 00:12:48 EDT 1999


[Bill Dozier]
> The text mode of pickling is not cross-platform and seems to
> expect UNIX linefeeds. :P

[Guido]
> Nonsense.  However you must open the file you're pickling to in binary
> mode: open(filename,'wb').

[Bill]
> Unfortunately, this detail is not found in the documentation. It
> certainly does not seem obvious that one should write a text file
> in binary mode.

It does if you've tried to port any other kind of text file from Windows to
Unix, whether via Python or C -- there's nothing unique to pickle in this!
Windows text files aren't properly read by Unix libc file routines, and
that's all there is to it.

text-files-aren't-portable-period-ly y'rs  - tim






More information about the Python-list mailing list