10000 Put user's name in the temp directory that gets created when the home… · matplotlib/matplotlib@0ee2e5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 0ee2e5d

Browse files
committed
Put user's name in the temp directory that gets created when the home directory is not writable. Fixes race conditions on a multi-user machine discovered by Matt Anderson.
1 parent 9eab454 commit 0ee2e5d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,11 @@ def _create_tmp_config_dir():
471471
If the config directory can not be created, create a temporary
472472
directory.
473473
"""
474+
import getpass
474475
import tempfile
475476

476-
tempdir = os.path.join(tempfile.gettempdir(), 'matplotlib')
477+
tempdir = os.path.join(
478+
tempfile.gettempdir(), 'matplotlib-%s' % getpass.getuser())
477479
os.environ['MPLCONFIGDIR'] = tempdir
478480

479481
return tempdir

0 commit comments

Comments
 (0)
0