ConfigParser reads capital keys and make them lower case

ConfigParser.ConfigParser() is documented to behave this way, in the Mapping Protocol Access section:

By default, all keys in sections are accessible in a case-insensitive manner. E.g. for option in parser["section"] yields only optionxform’ed option key names. This means lowercased keys by default.

That’s because this module parses Windows INI files which are expected to be parsed case-insensitively.

You can disable this behaviour by replacing the ConfigParser.optionxform() function:

self.config = ConfigParser.ConfigParser()
self.config.optionxform = str

str passes through the options unchanged.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)