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

Skip to content

Commit 962e609

Browse files
committed
FIX: ensure we import when the user cwd does not exist
This is the only place that we directly access the cwd in the main library.
1 parent 7e3cef3 commit 962e609

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/matplotlib/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ def matplotlib_fname():
496496
"""
497497

498498
def gen_candidates():
499-
yield os.path.join(os.getcwd(), 'matplotlibrc')
499+
# rely on down-stream code to make absolute. This protects us
500+
# from having to directly get if the current working directory
501+
# which can fail if the user has ended up with a cwd that is
502+
# non-existent.
503+
yield 'matplotlibrc'
500504
try:
501505
matplotlibrc = os.environ['MATPLOTLIBRC']
502506
except KeyError:

0 commit comments

Comments
 (0)