NoOptionError is not being raised when I try to get the value from a key that is not in the INI file. The following code snippet will hopefully demonstrate the problem. What happens for me is that the value for "bar" is set to None, instead of raising the error. I have the same problem if I read the values from an INI file.
I am running Python 2.7.12 and configparser 3.5.0, and installed configparser using Anaconda. Sorry in advance if I missed something really obvious or this is the expected behavior!
from backports import configparser parser = configparser.ConfigParser() parser.read_string(unicode(""" [options] foo = 10 """)) # This works print('foo', parser['options'].get('foo')) # I thought this would raise a NoOptionError, but instead returns None print('bar', parser['options'].get('bar'))