Running os.system from browser
michael at foord.net
Tue Jul 13 14:11:09 CEST 2004
"Sean Berry" <sean_berry at cox.net> wrote in message news:<jRGIc.5063$%w5.1899 at okepread05>...
> 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.
> import os
> 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.
I recently wrote a CGI that executes shell commands retrieved from a
It would fail (the dreaded internal error 500) when I used os.system
- but would work fine if I used os.popen2
It's likely that something similar is happening... although perhaps
someone more server savvy could confirm/explain.
More information about the Python-list