astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- Configuration System (`astropy.config`) »
- get_config

# get_config

astropy.config.get_config(packageormod=None, reload=False, rootname=None)

  Gets the configuration object or section associated with a particular package or module.

  Parameters:
    packageormod `python:str` or `python:None`

      The package for which to retrieve the configuration object. If a string, it must be a valid package name, or if `None`, the package from which this function is called will be used.

    reload bool, optional

      Reload the file, even if we have it cached.

    rootname `python:str` or `python:None`

      Name of the root configuration directory. If `None` and `packageormod` is `None`, this defaults to be the name of the package from which this function is called. If `None` and `packageormod` is not `None`, this defaults to `astropy`.

  Returns:
    cfgobj `configobj.ConfigObj` or `configobj.Section`

      If the requested package is a base package, this will be the `configobj.ConfigObj` for that package, or if it is a subpackage or module, it will return the relevant `configobj.Section` object.

  Raises:
    `RuntimeError`

      If `packageormod` is `None`, but the package this item is created from cannot be determined.