Skip to content Skip to sidebar Skip to footer

Mod_python Equivalent To Php Exec() Command

what is the mod_python equivalent to the php exec command? $cmd = '/var/www/scripts/test.py' + $parameter $return = exec($cmd) I've tried this but it doesn't return anything varRe

Solution 1:

Capture the stdout and stderr of the subprocess:

from subprocess import Popen, PIPE

proc = Popen(['/var/www/scripts/resolveId.py', 'arg1', 'arg2'], stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()

Post a Comment for "Mod_python Equivalent To Php Exec() Command"