Running os.system from browser
Thomas Guettler
guettli at thomas-guettler.de
Tue Jul 13 09:47:33 EDT 2004
Am Mon, 12 Jul 2004 18:25:07 -0700 schrieb Sean Berry:
> I have a python program that I want to
> be able to run from a browser window.
> 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 program also works from the command
> line. How can I fix this problem?
os.system() writes to stdout. This means if your
programm.py write to stdout it is send to the browser.
Use os.system('.. >> logfile 2>&1') or popen4
HTH,
Thomas
--
Thomas Güttler, http://www.thomas-guettler.de/
More information about the Python-list
mailing list