PLACE configuration

A module for working with the PLACE config file (‘.place.cfg’)

exception place.config.PlaceConfigError[source]

Error returned if there is a bad value in ~/.place.cfg file.

class place.config.PlaceConfig[source]

Class object for handling values in the PLACE config file.

get_config_value(section, name, default=None)[source]

Gets a value from the configuration file.

Parameters:
  • section (str) – the name of the section heading under which the value will be found in the config file. Typically this should be the class name (i.e. self.__class__.__name__) although this is not enforced.
  • name (str) – the name (or key) under which the value is stored in the config file
  • default (str) – (optional) a default value can be specified, which will be saved into the config file and used if another value does not exist in the config file
Returns:

the value from the configuration file

Return type:

str

Raises:

ValueError – if value does not exist in the config file and no default is specified (note that the value will be added to config file with a value of ‘fix_this_value’)

set_config_value(section, name, value)[source]

Sets a value in the config file and saves the file.

Typically, this should not be used by PLACE modules. Config values should be updated by the end-user by manually editing the config file.