Problems with file.write()
oren-py-l at hishome.net
Thu Aug 29 20:56:43 EDT 2002
On Thu, Aug 29, 2002 at 03:57:06PM -0700, Marc wrote:
> I have a problem that has me vexed. I am outputting to a log file that
> for some reason stops at random points thru-out execution. I am
> pulling text from a telnet conx into a buffer. I then simply turn
> around and print that to file. I know the text is there because I also
> print it to screen and to an output window in a GUI, and it shows up
> with no problem.
> And it's not intermittent printing either. It prints everything, and
> then it just stops prematurely.
> What possible reasons could cause Python to stop outputting to file?
Sounds like a buffering problem. Try f.flush() or opening the file with
a different buffering mode e.g. open('filename', 'w', 1)
More information about the Python-list