Python and CGI

Alex Martelli alex at magenta.com
Mon Aug 14 16:00:16 EDT 2000


"Drew Fisher" <drew at level3.net> wrote in message
news:3998264A.4718F09E at level3.net...
> Hello,
>
> I think this may be more of a CGI question, but I'm not too sure where
> else to go.
>
> I have a python script that takes a long time to run and my
> Pointy-Haired Boss wants it to be a webpage.
>
> Since the script takes longer than the Timeout parameter allows, I need
> to find a way to flush some of the data to the web page before the
> CGI script gets finished.

If you run your script 'python -u' (ie, pass a -u flag to the python
interpreter), output will be unbuffered: anything you print goes out
at once.  Alternatively, call sys.stdout.flush() once in a while, to
flush the output buffer from whatever was printed up to that point --
it goes to the 'real' output channel "right then and there".


Alex






More information about the Python-list mailing list