The guidata.userconfig module provides user configuration file (.ini file) management features based on ConfigParser (standard Python library).

It is the exact copy of the open-source package userconfig (MIT license).


Return user home directory


Encode unicode string in UTF-8 – but only with Python 2

class guidata.userconfig.UserConfig(defaults)[source]

UserConfig class, based on ConfigParser name: name of the config options: dictionnary containing options or list of tuples (section_name, options)

Note that ‘get’ and ‘set’ arguments number and type differ from the overriden methods


Check the static options for forbidden data types


Return configuration (not application!) version

set_version(version='0.0.0', save=True)[source]

Set configuration (not application!) version


Create a .ini filename located in user home directory


Remove .ini file associated to config


Set defaults from the current config

reset_to_defaults(save=True, verbose=False)[source]

Reset config to Default values

get_default(section, option)[source]

Get Default value for a given (section, option)

Useful for type checking in ‘get’ method

get(section, option, default=<class guidata.userconfig.NoDefault at 0x0000000003D11948>, **kwargs)[source]

Get an option section=None: attribute a default section name default: default value (if not specified, an exception will be raised if option doesn’t exist)

set_default(section, option, default_value)[source]

Set Default value for a given (section, option) -> called when a new (section, option) is set and no default exists

set(section, option, value, verbose=False, save=True)[source]

Set an option section=None: attribute a default section name