Python ConfigParser.NoSectionError: No section:

You’re defining your path with backslashes:

configFilePath="E:\Python\configfile\test.txt"

These get interpreted as escapes, and as a result the correct file isn’t being loaded. (Unfortunately, the error message doesn’t help much in this instance.) You either need to escape them, or use a raw string:

configFilePath = r'E:\Python\configfile\test.txt'

Leave a Comment