I think ' sys.stdout.flush()' after each print might do it.
On 06/06/07, Erik de Castro Lopo <[EMAIL PROTECTED]> wrote:
Lindsay Holmwood wrote: > When I run the program it prints out each line to the shell with the > delay as expected, but when I redirect stdout to a file the output is > written in big chunks of 30+ lines. I think you find the chunks are 4k each. > Is anyone able to give me suggestions on what's going on here? Your stdout is alomost certain a C FILE* underneath which when writing to a file is buffer in 4k chunks. In C, you can change the output buffering using the setvbuf function. Not sure how to do this in Python. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "There are no jokes in Islam. There is no humor in Islam. There is no fun in Islam. There can be no fun and joy in whatever is serious." -- Ayatollah Khomeini _______________________________________________ coders mailing list coders@slug.org.au http://lists.slug.org.au/listinfo/coders
-- Michael Connors
_______________________________________________ coders mailing list coders@slug.org.au http://lists.slug.org.au/listinfo/coders