Python 类型错误:';第'节;对象不可调用
我正在尝试测试python程序。我对python模块没有足够的了解。当我运行我得到的程序时,比如errorserver=myconf.getoption('server')TypeError:'Section'对象是不可调用的,这是我试图运行的程序的一部分Python 类型错误:';第'节;对象不可调用,python,Python,我正在尝试测试python程序。我对python模块没有足够的了解。当我运行我得到的程序时,比如errorserver=myconf.getoption('server')TypeError:'Section'对象是不可调用的,这是我试图运行的程序的一部分 import sys from zabbix_api import ZabbixAPI import simpleconfigparser #print(sys.argv) key=sys.argv[1] triggerDict=sys.a
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')
我该怎么做?一个“如何使用simpleconfigparser”的示例
从
如果ini文件包含以下内容:
[app]
debug = yes
您可以通过以下方式使用它:
from simpleconfigparser import simpleconfigparser
config = simpleconfigparser()
config.read('read.ini')
print(config.app.debug)
print(config.app.getboolean('debug'))
print(config['app']['debug'])
请显示完整的错误消息和traceback.traceback(最后一次调用):文件“original_ack.py”,第17行,在server=myconf.getoption('server')TypeError中:“Section”对象不可调用,这是我在运行程序时得到的。请显示zabbix-api-auth.conf的内容