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

Eric Walstad eric at ericwalstad.com
Thu Nov 4 12:59:49 EST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

LarsenMTL wrote:

> "Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message
> news:<cmb3nl$sj4$00$1 at news.t-online.com>...
>> > 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.
>> 
>> Did you try to daemonize your script? That will decouple it from the
>> running
>> process, so maybe that helps. In the  aspn cookbook there is a good
>> recipe for daemonizing.
> 
> Thanks.  I think I got it.  Looking at that recipe hinted me at the
> idea that I need to close or redirect stdin, stdout and stderr.  Some
> searches around here confirmed that.
> 
> Cheers.
Hi Mark,

Would you mind posting a snippet of how you solved the problem?  I'd
appreciate seeing what you did.

Thanks,

Eric.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBim4ThlnH2nphKS4RArFhAKDgEBBQvIZjdn39kmcCg2k00opJWgCfTtP0
E2ByNLFDa4eavr25H5MWZ80=
=UU+k
-----END PGP SIGNATURE-----



More information about the Python-list mailing list