@@ -530,26 +530,27 @@ def _get_config_or_cache_dir(xdg_base_getter):
530
530
configdir = configdir .resolve ()
531
531
try :
532
532
configdir .mkdir (parents = True , exist_ok = True )
533
- except OSError :
534
- pass
533
+ except OSError as exc :
534
+ _log . warning ( "mkdir -p failed for path %s: %s" , configdir , exc )
535
535
else :
536
536
if os .access (str (configdir ), os .W_OK ) and configdir .is_dir ():
537
537
return str (configdir )
538
+ _log .warning ("%s is not a writable directory" , configdir )
538
539
# If the config or cache directory cannot be created or is not a writable
539
540
# directory, create a temporary one.
540
541
try :
541
542
tmpdir = tempfile .mkdtemp (prefix = "matplotlib-" )
542
543
except OSError as exc :
543
544
raise OSError (
544
545
f"Matplotlib requires access to a writable cache directory, but the "
545
- f"default path ({ configdir } ) is not a writable directory , and a temporary "
546
+ f"default path ({ configdir } ) is inaccessible , and a temporary "
546
547
f"directory could not be created; set the MPLCONFIGDIR environment "
547
548
f"variable to a writable directory" ) from exc
548
549
os .environ ["MPLCONFIGDIR" ] = tmpdir
549
550
atexit .register (shutil .rmtree , tmpdir )
550
551
_log .warning (
551
552
"Matplotlib created a temporary cache directory at %s because the default path "
552
- "(%s) is not a writable directory ; it is highly recommended to set the "
553
+ "(%s) is inaccessible ; it is highly recommended to set the "
553
554
"MPLCONFIGDIR environment variable to a writable directory, in particular to "
554
555
"speed up the import of Matplotlib and to better support multiprocessing." ,
555
556
tmpdir , configdir )
0 commit comments