Skip to content

Commit

Permalink
Fix issues with getting tempdir when unknown uid
Browse files Browse the repository at this point in the history
  • Loading branch information
cancan101 committed Feb 1, 2016
1 parent bbe421a commit c041352
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,13 @@ def _create_tmp_config_dir():
# Some restricted platforms (such as Google App Engine) do not provide
# gettempdir.
return None
tempdir = os.path.join(tempdir, 'matplotlib-%s' % getpass.getuser())

try:
username = getpass.getuser()
except KeyError:
username = str(os.getuid())
tempdir = os.path.join(tempdir, 'matplotlib-%s' % username)

os.environ['MPLCONFIGDIR'] = tempdir

mkdirs(tempdir)
Expand Down

0 comments on commit c041352

Please sign in to comment.