Python CGI - Accepting Input, Invoking Another Process, Ending CGI

Eric Walstad eric at ericwalstad.com
Thu Nov 4 11:19:31 EST 2004


LarsenMTL wrote:

> Python Users:
> 
> Based on previous suggestions from this group, I'm attempting to write
> a python CGI that takes input from an HTML form, invokes a second
> python script using this input, tells the user that their process has
> started, ends the cgi output and later emails the results of the
> invoked script.
> 
> My problem is that no mater how I invoke the 2nd script (spawnlp with
> P_NOWAIT, system with &, etc..) the CGI caller continues to run until
> it finishes.  If you press the stop button or close the browser
> certain portions of the 2nd script finish but not all of it.  In
> paticular the 2nd script uses teTex (invoked by os.system) to process
> some tex files, this always errors out if the browser is closed or
> stopped.
> 
> Regardless of all that, what is the proper way to have a python CGI
> batch another python script?
> 
> Thanks,
> 
> Mark

Hi Mark,

I had to do something like this in mod_python.  I ended up using a
mod_python function to detach the process from the request.  I don't know
how mod_python handles it, but it worked for me may be a lead for you to
follow (looking at the mod_python source, that is):
<http://www.modpython.org/pipermail/mod_python/2004-June/015719.html>

Best,

Eric.



More information about the Python-list mailing list