2011-08-31 47 views
1

我将如何去测试从python的Apache配置文件?我使用“os.popen”与“文本= stdout_handle.read()得到的结果很努力,但没有任何反应。从Python测试Apache配置文件

:)

+0

能否请您给多一点细节,你在做什么,为什么这样做它和你无法做什么? –

回答

1

我猜你任何帮助将是巨大的” ?重新尝试自动apachectl configtest你试过subprocess.Popen像下面应该让你在开始:

from subprocess import Popen, PIPE 

args = ['/usr/bin/apachectl','configtest'] 

result = Popen(args,stdout=PIPE,stderr=PIPE).communicate() 
# result[0] will be the standard output, result[1] will be the stderr output 

http://docs.python.org/library/subprocess.html#popen-objects