Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型错误:';第'节;对象不可调用_Python - Fatal编程技术网

Python 类型错误:';第'节;对象不可调用

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

我正在尝试测试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.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的内容