| Jim Gallacher 2005-04-30, 5:45 pm |
| Nicolas Lehuen wrote:
> On 4/28/05, Nicolas Lehuen <nicolas.lehuen@gmail.com> wrote:
>
>
>
> OK, this is done.
>
>
>
>
> Found it. It turns out that we need to open the session file in binary
> mode for reading and writing.
>
> I've never really understood why, but on Win32 files can be opened in
> text mode, in which some control characters mean an EOF. If you try to
> write binary data in a text-mode file, and your binary data contains
> an EOF character, then you're out of luck. You have to open the file
> in binary mode, by adding an 'b' to the mode.
>
> What lead to to find this was that when using the text-friendly
> pickling protocol 0, there was no problem. The bug only appeared when
> using the binary pickling protocol 2.
>
Ah, yes. One of those cross-platform wrinkles. Glad the fix was simple.
Jim
|