小编Log*_*amy的帖子

Python:ConfigParser.NoSectionError:没有部分:'TestInformation'

我收到ConfigParser.NoSectionError:没有部分:使用上面的代码'TestInformation'错误.

def LoadTestInformation(self):        
    config = ConfigParser.ConfigParser()    
    print(os.path.join(os.getcwd(),'App.cfg'))

    with open(os.path.join(os.getcwd(),'App.cfg'),'r') as configfile:       
        config.read(configfile)
        return config.items('TestInformation')
Run Code Online (Sandbox Code Playgroud)

文件路径是正确的,我已经双重检查.并且配置文件具有TestInformation部分

[TestInformation]

IEPath = 'C:\Program Files\Internet Explorer\iexplore.exe'

URL = 'www.google.com.au'

'''date format should be '<Day> <Full Month> <Full Year>'

SystemDate = '30 April 2013'
Run Code Online (Sandbox Code Playgroud)

在app.cfg文件中.不确定我做错了什么

python configparser

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

configparser ×1

python ×1