什么是mod_python等同于php exec命令?
$cmd = '/var/www/scripts/test.py' + $parameter
$return = exec($cmd)
我试过这个,但它不会返回任何内容
varReturn= subprocess.check_output(['/var/www/scripts/resolveID.py ', varParameters)
答案 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()