Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1b11e2f

Browse filesBrowse files
committed
Merge pull request #3487 from mdboom/use-getcwdu
BUG : use getcwdu to deal with unicode in user home-path in python 2
2 parents cb36b28 + 0a41d83 commit 1b11e2f
Copy full SHA for 1b11e2f

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,11 @@ def matplotlib_fname():
745745
- Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a
746746
system-defined copy.
747747
"""
748-
fname = os.path.join(os.getcwd(), 'matplotlibrc')
748+
if six.PY2:
749+
cwd = os.getcwdu()
750+
else:
751+
cwd = os.getcwd()
752+
fname = os.path.join(cwd, 'matplotlibrc')
749753
if os.path.exists(fname):
750754
return fname
751755

‎lib/matplotlib/sphinxext/plot_directive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/sphinxext/plot_directive.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,10 @@ def run_code(code, code_path, ns=None, function_name=None):
447447
# Change the working directory to the directory of the example, so
448448
# it can get at its data files, if any. Add its path to sys.path
449449
# so it can import any helper modules sitting beside it.
450-
451-
pwd = os.getcwd()
450+
if six.PY2:
451+
pwd = os.getcwdu()
452+
else:
453+
pwd = os.getcwd()
452454
old_sys_path = list(sys.path)
453455
if setup.config.plot_working_directory is not None:
454456
try:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.