2011-08-31 51 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