SpacePy has a few tunable options that can be altered through the spacepy.rc configuration file. All options have defaults which will be used if not specified in the configuration file. These defaults are usually fine for most people and may change between SpacePy releases, so we do not recommend changing the configuration file without substantial reason.
spacepy.rc lives in the per-user SpacePy directory, called .spacepy. On Unix-like operating systems, it is in a user’s home directory; on Windows, in the user’s Documents and Settings folder. If it doesn’t exist, this directory (and spacepy.rc) is automatically created when SpacePy is imported.
spacepy.rc has an INI-style format, parsed by ConfigParser. It contains a single section, [spacepy].
When first imported, spacepy will create a .spacepy directory in your $HOME folder. If you prefer a different location for this directory, set the environment variable $SPACEPY to a location of your choice. For example, with a csh, or tcsh you would:
setenv SPACEPY /a/different/dir
for the bash shell you would:
If you change the default location, make sure you add the environment variable $SPACEPY to your .cshrc, .tcshrc, or .bashrc script.
spacepy.rc is loaded into a dictionary (spacepy.config) by SpacePy’s main __init__.py. All options from the [spacepy] section are loaded, with no developer intervention needed. Each key is the option’s name; the associated value is the option’s value. To specify a default, add to the defaults dictionary at the top of _read_config; each default, if not overridden by the config file, will be included in the config dict. Values are assumed to be strings. The caster dictionary is keyed by option name; the value for each key is a function to be applied to the value with the same key to produce a different type from a string.
|Doc generation date:|
|May 21, 2013|
For additions or fixes to this page, contact the SpacePy Team at Los Alamos.