先说一下在读取配置文件时报错的问题--ConfigParser.MissingSectionHeaderError: File contains no section headers
问题描述:
在练习ConfigParser读取配置文件时,cmd一直报一个错:ConfigParser.MissingSectionHeaderError: File contains no section headers.如图:
D:\test_python>python task_test.py
Traceback (most recent call last):
File "task_test.py", line 20, in
pp=ParsePageObjectRepositoryConfig()
File "task_test.py", line 9, in __init__
self.cf.read("D:\\test_python\\dataDriven\\conf\\PageObjectRepository.ini")
File "C:\Python27\lib\ConfigParser.py", line 305, in read
self._read(fp, filename)
File "C:\Python27\lib\ConfigParser.py", line 512, in _read
raise MissingSectionHeaderErr