Apache Mod-Python - Re: release? FileSession.py

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > April 2005 > Re: release? FileSession.py





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: release? FileSession.py
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




Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com