Possible read()/readline() bug?
pruebauno at latinmail.com
pruebauno at latinmail.com
Thu Oct 23 10:19:36 EDT 2008
On Oct 23, 9:48 am, Mike Kent <mrmak... at cox.net> wrote:
> To followup on this:
>
> Terry: Yes, I did in fact miss the 'buffer' parameter to open.
> Setting the buffer parameter to 0 did in fact fix the test code that I
> gave above, but oddly, did not fix my actual production code; it
> continues to get the data as first read, rather than what is currently
> on the disk. I'm still investigating why.
>
> Carl: I tried the above test code, without 'buffer=0' in the open, but
> with a flush added before reads in the appropriate places. The flush
> made no difference; readline continued to return the old data rather
> than what was actually on the disk. So, flush isn't the answer. I
> suppose that means that, when the document states it flushes the
> buffer, it's referring to the output buffer, not the input buffer.
Something odd is going on for sure. I had a couple of theories but
then I tested it on both Windows XP and AIX and could not reproduce
the problem even using the default buffer setting. As soon as I do a
seek and read it gives me the new data. I wonder if other people can
test this out on different operating systems and file systems and
detect a pattern.
More information about the Python-list
mailing list