File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Original file line number Diff line number Diff line change @@ -495,12 +495,19 @@ def _create_tmp_config_dir():
495
495
"""
496
496
If the config directory can not be created, create a temporary
497
497
directory.
498
+
499
+ Returns None if a writable temporary directory could not be created.
498
500
"""
499
501
import getpass
500
502
import tempfile
501
503
502
- tempdir = os .path .join (
503
- tempfile .gettempdir (), 'matplotlib-%s' % getpass .getuser ())
504
+ try :
505
+ tempdir = tempfile .gettempdir ()
506
+ except NotImplementedError :
507
+ # Some restricted platforms (such as Google App Engine) do not provide
508
+ # gettempdir.
509
+ return None
510
+ tempdir = os .path .join (tempdir , 'matplotlib-%s' % getpass .getuser ())
504
511
os .environ ['MPLCONFIGDIR' ] = tempdir
505
512
506
513
return tempdir
@@ -519,7 +526,9 @@ def _get_configdir():
519
526
create it if necessary).
520
527
2. If the chosen directory exists and is writable, use that as the
521
528
configuration directory.
522
- 3. Create a temporary directory, and use it as the configuration directory.
529
+ 3. If possible, create a temporary directory, and use it as the
530
+ configuration directory.
531
+ 4. A writable directory could not be found or created; return None.
523
532
"""
524
533
525
534
configdir = os .environ .get ('MPLCONFIGDIR' )
You can’t perform that action at this time.
0 commit comments