2016-06-02 14 views
-2

私はPythonプログラムをテストしようとしています。私はPythonモジュールについて十分な知識がありません。 'セクションオブジェクトが呼び出すことはできません、これは私がTypeError: 'Section'オブジェクトが呼び出せません

import sys 
from zabbix_api import ZabbixAPI 
import simpleconfigparser 

#print(sys.argv) 
key=sys.argv[1] 
triggerDict=sys.argv[2] 
try: 
    debugStatus=sys.argv[3] 
except: 
    debugStatus=0 

authfile = 'zabbix-api-auth.conf' 

myconf = simpleconfigparser.simpleconfigparser() 
print myconf.read(authfile) 
server=myconf.getoption('server') 
username=myconf.getoption('username') 
password=myconf.getoption('password') 

を実行しようとしているプログラムの一部です:私はこのようなエラーサーバー= myconf.getoption(「サーバ」)はTypeErrorとして得たプログラムを実行すると、どうすればいいですか?

from simpleconfigparser import simpleconfigparser 

config = simpleconfigparser() 
config.read('read.ini') 

print(config.app.debug) 
print(config.app.getboolean('debug')) 
print(config['app']['debug']) 

[app] 
debug = yes 

あなたが使用してそれを使用することができます: -

+1

完全なエラーメッセージとトレースバックを表示してください。 –

+0

**トレースバック(直近の最後の呼び出し): ファイル "original_ack.py"、行17、 server = myconf.getoption( 'server') TypeError: 'Section'オブジェクトは呼び出し可能ではありません**プログラムを実行するときに取得します。 – pico

+0

zabbix-api-auth.confの内容を表示してください – Yaron

答えて

関連する問題