Unbuffered stdout

Fredrik Lundh fredrik at pythonware.com
Mon Nov 29 09:24:51 EST 1999


leon <leonar_n at epita.fr> wrote:
> I'm developping an IRC like software which must work on the Web. I can't use
> Java, and I'm using Python to program the CGI. But, I have a big problem : I
> don't know how to make the stdout unbuffered.
> I tried to make some
>     sys.stdout.write("test")
>     sys.stdout.flush()
> but it don't work.

looks fine to me.  maybe something else
is wrong?

anyway, you could try running the inter-
preter with the -u option:

$ python -?
Unknown option: -?
usage: python [option] ... [-c cmd | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
...
-u     : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)
...

</F>





More information about the Python-list mailing list