Jon-Pierre Gentil
jgentil at sebistar.net
Mon Apr 9 12:26:18 EDT 2007
Sebastien Maret wrote: > import os > > def index(req): > > p = os.popen ("/bin/sh", 'w') > p.write ("ls >> log") > p.close () > > f = open("log") > s = f.readlines() > f.close() > > return s > > Although the same kind of script works fine when I run it from the > command line, it does not work when I put it on my webserver. The pipe > does not seems to be opened. Is it for security reasons? Is there a > workaround? It looks like you're returning the string instead of using req.write() to output the data. A request handler expects an HTTP code return value, not the string output.. See http://www.modpython.org/live/current/doc-html/pyapi-handler.html
|