Running os.system from browser
Tim Daneliuk
tundra at tundraware.com
Mon Jul 12 22:40:11 EDT 2004
Sean Berry wrote:
> 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.
>
>
At first glance, this suggests itself:
os.system('/path/to/python /path/to/my/program.py')
I
--
----------------------------------------------------------------------------
Tim Daneliuk tundra at tundraware.com
PGP Key: http://www.tundraware.com/PGP/
More information about the Python-list
mailing list