Problems with file.write()

Marc mnations at airmail.net
Mon Sep 2 12:24:13 EDT 2002


> Note that all buffered data is flushed automatically when you close()
> an output file (you *are* closing the file, aren't you?).

Actually I wasn't closing the file originally but it had never been a
problem before. But closing the file now causes it to spill it's guts
and gives me everything I was looking for.

However, that doesn't explain why it wasn't working in the first
place. I originally had it in unbuffered mode and wasn't getting all
my text. As I increased the buffering from 1 to 2 I kept getting more
text. But never all of it until I closed the file. It seems like it
shouldn't be necessary to flush the buffer after every write if you're
in unbuffered mode. This seems like a problem.



More information about the Python-list mailing list