mod_python等同于php exec()命令

时间:2011-03-03 20:08:35

标签: php python exec mod-python

什么是mod_python等同于php exec命令?

$cmd = '/var/www/scripts/test.py' + $parameter
$return = exec($cmd)

我试过这个,但它不会返回任何内容

varReturn= subprocess.check_output(['/var/www/scripts/resolveID.py ', varParameters)

1 个答案:

答案 0 :(得分:1)

捕获子进程的stdout和stderr:

from subprocess import Popen, PIPE

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