how do i disable buffered output, like Perl's '$|=1'?

Moshe Zadka moshez at zadka.site.co.il
Sun Jan 14 21:46:42 EST 2001


On Sun, 14 Jan 2001 19:05:58 +0100, "floR" <flor_pino at hotmail.com> wrote:
> Not exactly what I meant, I think.
> Okay, what I want to do in particular, is to send 'print' commands to the
> browser in intervals, without buffering, something like the following:
> 
> print 'Content-type: text/html\n\n'
> countdown = 10
> while countdown:
>     print countdown
>     countdown = countdown - 1
>     sleep(1)
> 
> so that the countdown seems to happen in your browser, instead of waiting
> for 10 seconds for the string '10 9 8 7 6 5 4 3 2 1' to appear.

Other then the suggestion I made, note that the server may be buffering
output of CGI scripts itself. Generally, you don't do these type of things
in CGI. (Browsers may buffer themselves, too, something you have no
control about)
See: http://www.unixinsider.com/swol-02-2000/swol-02-regex.html
for correct ways to do it.
-- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!




More information about the Python-list mailing list