Somewhere in your code you're doing this:
config.set('something', 'something', 0) # or some integer
Or optionally you're passing in a non-string value in your ConfigParser
constructor dict
.
This is subtly against what the docs say:
If the given section exists, set the given option to the specified value; otherwise raise NoSectionError. While it is possible to use RawConfigParser (or ConfigParser with raw parameters set to true) for internal storage of non-string values, full functionality (including interpolation and output to files) can only be achieved using string values.
So whenever you call ConfigParser.set
, make sure you wrap what you're setting in str
. Otherwise it throws an error when it runs through all the values in _interpolate
. (I consider some part of this behavior a bug, but it's probably kept as-is for backwards compatibility. Or something.)
Another good thing to do is use SafeConfigParser
which will throw a TypeError
if you try to set a non-string value, so you know this won't happen again.