ConfigParser use to read configuration files, often found through Notepad, the following questions arise when reading the notepad ++ to modify the configuration file:
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: ../conf/mal_crawler_allcids.conf, line: 1
'\xef\xbb\xbf[basic_config]\r\n'
After commissioning program finds the file header information to be added: \ xef \ xbb \ xbf, then resolve the error ConfigParser
google the next \ xef \ xbb \ xbf, reason: When using Notepad, notepad and other editing files window below, if saved as UNICODE or UTF-8, respectively, will add two bytes "\ xFF \ xFE" and three bytes "\ xEF \ xBB \ xBF" in the beginning of the file. Namely: BOM
Solution: profile before use, to remove these bytes BOM
def remove_BOM(config_path):
content = open(config_path).read()
content = re.sub(r"\xfe\xff","", content)
content = re.sub(r"\xff\xfe","", content)
content = re.sub(r"\xef\xbb\xbf","", content)
open(config_path, 'w').write(content)
Is not the problem, please do not mention it away.