Traceback (most recent call last):
File "common_config.py", line 27, in <module>
env_config_parser.read(env_config_path,'utf-8')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\configparser.py", line 696, in read
self._read(fp, filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\configparser.py", line 1079, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'D:\\bookgo\\www\\gsl_api\\extend\\ppython\\python\\common\\../../../../env.ini', line: 1
'\ufeff[redis]\n'
以上读取配置文件,读取到了,但是报错,是因为字符编码 未 utf-8-BOM
搞不懂为什么会变成这个编码,改为utf-8就ok 了
方法,使用notepad++ 打开文件,上方编码 点击使用utf8或你想要的格式 ok