cgi and popen

Thomas Guettler niemand.leermann at
Wed Jun 7 16:53:45 CEST 2006

Am Wed, 07 Jun 2006 14:54:41 +0200 schrieb Maarten van Veen:

> A long story made short, I've build a python/cgi website consisting of 
> two pages. Page1 has a html form in which you can input a series of 
> queries. Then via Popen it starts a pythons search script, which stores 
> the results in a python shelve.
> As the Popen command is given it should redirect to page2, which will 
> check if the shelve is ready (search finished) and if not displays a 
> search page, refreshing itself after 10 seconds.
> The Popen command works nice when tried out in the console. The script 
> isueing the Popen quits, and the other process keeps on running till 
> finished.


You can find out where the process hangs, by
sending SIGINT to the python script:


This is like ctrl-c, you should get a traceback.

If the page1 script is not alive anymore, during
the unwanted waiting, this does not work.

Which form of popen do you use? Popen4 is the best,
because you cannot get a deadlock if there is output
on stdout and stderr.

I guess you have the same strange thing, if you
ssh to the server, start the script1 and you want
to logoff before the subprocesses is finished.

You can try to start the script like this:

nohup nice mein-script >> $HOME/log/mein-script.log 2>&1 </dev/null &


Thomas Güttler,
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: niemand.leermann at

More information about the Python-list mailing list