Probably the reason it doesn't work is because lighttpd is a daemon, and daemons close the file descriptors stdin / stdout / stderr. To run the program, a terminal with open descriptors is required, but they are inherited from the caller and, therefore, are closed. Therefore, when calling an external program, you must provide them yourself. For instance:
from subprocess import call, STDOUT, PIPE
retval = call(['program', 'arg1', 'arg2'], stdin = PIPE, stdout = PIPE, stderr = STDOUT)
See explanations and examples in Python Docs
source
share