python cgi webpage won't redirect before background children processes finish

Yingjie Lin Yingjie.Lin at
Tue Feb 22 23:01:39 CET 2011

Hi all,

I have a python cgi script which looks like this:

print 'Content-Type: text/html\n\n'
print '<meta http-equiv="refresh" content="15;url=%s">' % myURL
### after printing the webpage
logfile.write('END OF SCRIPT')

Question: I want this cgi webpage to automatically redirect to myURL after 15 seconds. 
As soon as the execution of this script finishes, the corresponding job disappears from 
ps command output, the webpage is displayed and the log file is written. However, the 
webpage doesn't redirect after 15 seconds unless the background child process 
'python' finishes by then.

Is this problem caused by initialing the children job through os.system() ? Does any one 
know what I need to change to make the redirection work before background children processes finish?

Thank you very much!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list