By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,675 Members | 2,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,675 IT Pros & Developers. It's quick & easy.

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

P: 1
Hi all,

I have a python cgi script which looks like this:

Expand|Select|Wrap|Line Numbers
  1. logfile = open('xxxxxxxxx')
  2. print "Content-Type: text/html\n\n"
  3. .....
  4. print '    <meta http-equiv="refresh" content="15;url=%s" />' % myURL
  5. ......
  6. ### after printing the page
  7. os.system('python &')
  8. logfile.write('END OF SCRIPT')
  9. logfile.close()
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?
Feb 22 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.