setvbuf() ??

Donn Cave donn at u.washington.edu
Thu Mar 29 11:39:54 EST 2001


Quoth wcuddy at lserv.ja10629.home (Wayne Cuddy):
| I need to print a period on an xterm every few seconds to provide status to the
| user, I don't want to force a newline.  How do I turn off line buffering for
| standard out?

I don't know, but you don't need that anyway - if you don't want buffered
output then don't use an output buffer like stdout!

You can write directly to standard output like this:

   os.write(1, '.')

Unit 1 is by definition standard output;  2 is error and 0 is input.
File objects stdout, stderr and stdin use these same file descriptors
eventually, via C library stdio functions, so when you write directly
to them you just omit a lot of extra stuff you don't want.

If you really want a file object for some reason, stderr normally will
be unbuffered.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list