[mod_python] popen() and mod_python

Sebastien Maret sebastien.maret at gmail.com
Mon Apr 9 00:37:41 EDT 2007


Hello,

I need to write a Python script that open an other program through a
pipe. For example:

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?

Thanks,
Sébastien








More information about the Mod_python mailing list