RE: configparser get non-existent boolean

2025-07-01 Thread Anders Munch
Rob Cliffe wrote: > I was surprised to find that in configparser, getboolean() does not raise > KeyError for a non-existent config parameter. > Is there a good reason for this? History and backwards compatibility. The configparser module has some years on it. The rationale for this sort of thi

configparser get non-existent boolean

2025-06-30 Thread Rob Cliffe via Python-list
I was surprised to find that in configparser, getboolean() does not raise KeyError for a non-existent config parameter. Demo program (Python 3.11.5, Windows 11): import configparser config = configparser.ConfigParser() config.read('ThisFileDoesNotExist.ini') # This line could be removed MY_BOOL