Running os.system from browser

Sean Berry sean_berry at cox.net
Tue Jul 13 03:25:07 CEST 2004


I have a python program that I want to
be able to run from a browser window.

It gets run in a cron job every day, but
I want my boss to be able to run it whenever
he wants to since the database it uses is
updated many times throughout the day.

I have the following as the first few lines
of a program.

#!/usr/local/bin/python
import os
os.system('/path/to/my/program.py')
print "Content-Type: text/html\n"

The rest of the program just spits out some
simple html.  Ths os.system call is what is
breaking the program when I run it from a
browser, because I have commented it out
and the program works.

The program also works from the command
line.  How can I fix this problem?

Thanks for any help.





More information about the Python-list mailing list