python cgi problem
Joonas Paalasmaa
joonas at olen.to
Mon Mar 25 16:34:41 EST 2002
etienne wrote:
>
> hi there !
>
> I'm programming such a cgi:
> step 1- user submits some data
> step 2- cgi validates data
> step 3- outputs a html file telling the user to wich url point to find
> output
> step 4- do the hard work.
>
> the reason for step 3 is that step 4 needs to dig in a very large
> database, and may take lot of time
>
> everything woks fine but output of step3 comes when step 4 is over and
> user needs to wait up to some minutes for his response.
>
> cgi schema is as follow:
>
> def main():
> # 2
> params = validate_params()
> # 3
> htm_out = generate_output()
> print htm_out
> # 4
> os.system(" python my_module.py params &")
>
> I can see results of print htm_out when os.system(" python
> my_module.py params &") is over
>
> can i force htm_out output somehow ???
It is explained at
http://starship.python.net/crew/davem/cgifaq/faqw.cgi?req=show&file=faq02.005.htp
how to run commands in the background from CGI scripts. Also
sys.stdout.flush() might work for your purpose.
More information about the Python-list
mailing list