Running os.system from browser

Thomas Guettler guettli at
Tue Jul 13 15:47:33 CEST 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/')
> 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 write to stdout it is send to the browser.

Use os.system('.. >> logfile 2>&1') or popen4


Thomas Güttler,

More information about the Python-list mailing list