Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be72e1b

Browse files
committed
update docstrings and faq for modified config directory strategy
1 parent 57399e2 commit be72e1b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

doc/faq/environment_variables_faq.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ Environment Variables
2525

2626
This is the directory used to store user customizations to matplotlib, as
2727
well as some caches to improve performance. If :envvar:`MPLCONFIGDIR` is not
28-
defined, :file:`{HOME}/.matplotlib` is used by default.
28+
defined, :file:`{HOME}/.matplotlib` is used if it is writable.
29+
Otherwise, the python standard library :func:`tempfile.gettmpdir` is
30+
used to find a base directory in which the :file:`matplotlib`
31+
subdirectory is created.
2932

3033
.. _setting-linux-osx-environment-variables:
3134

lib/matplotlib/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,14 @@ def _create_tmp_config_dir():
483483

484484
def _get_configdir():
485485
"""
486-
Return the string representing the configuration dir.
486+
Return the string representing the configuration directory.
487487
488-
default is HOME/.matplotlib. you can override this with the
489-
MPLCONFIGDIR environment variable
488+
Default is HOME/.matplotlib. You can override this with the
489+
MPLCONFIGDIR environment variable. If the default is not
490+
writable, and MPLCONFIGDIR is not set, then
491+
tempfile.gettempdir() is used to provide a directory in
492+
which a matplotlib subdirectory is created as the configuration
493+
directory.
490494
"""
491495

492496
configdir = os.environ.get('MPLCONFIGDIR')

0 commit comments

Comments
 (0)