unpickle from URL problem

Hrvoje Niksic hniksic at xemacs.org
Wed Oct 10 17:02:55 EDT 2007


Alan Isaac <aisaac at american.edu> writes:

> Hrvoje Niksic wrote:
>> The first upload breaks the file.  You uploaded it in (presumably
>> FTP's) text mode, which changes \n -> \r\n.  But you download it using
>> http, which specifies no such conversion in the opposite direction.
>
> No: I used binary upload both time.
> (Unless my ftp client is broken, and I think not.)
>
> The first example simply keeps the Windows eols,
> which are present in the pickled file on my Windows machine.

That's why it doesn't work on Unix, the \r's are a problem when not
removed by the platform's IO layer.  Because of the newline silliness,
the notion of a "text file" is, unfortunately, quite platform-specific
even when the file is pure ASCII, so pickle protocol 0 being textual
is a bit misleading regarding the resulting file's portability.  :-(



More information about the Python-list mailing list