From 0a41d838ac8f0c4e5aba43e0c52872312f71564c Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Fri, 12 Sep 2014 12:58:46 -0400 Subject: [PATCH] Allow running from non-ascii directory on Windows --- lib/matplotlib/__init__.py | 6 +++++- lib/matplotlib/sphinxext/plot_directive.py | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 25d7e04f3103..8a20272636f0 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -745,7 +745,11 @@ def matplotlib_fname(): - Lastly, it looks in `$MATPLOTLIBDATA/matplotlibrc` for a system-defined copy. """ - fname = os.path.join(os.getcwd(), 'matplotlibrc') + if six.PY2: + cwd = os.getcwdu() + else: + cwd = os.getcwd() + fname = os.path.join(cwd, 'matplotlibrc') if os.path.exists(fname): return fname diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py index 08093fe2a7ec..efc41f284dc8 100644 --- a/lib/matplotlib/sphinxext/plot_directive.py +++ b/lib/matplotlib/sphinxext/plot_directive.py @@ -447,8 +447,10 @@ def run_code(code, code_path, ns=None, function_name=None): # Change the working directory to the directory of the example, so # it can get at its data files, if any. Add its path to sys.path # so it can import any helper modules sitting beside it. - - pwd = os.getcwd() + if six.PY2: + pwd = os.getcwdu() + else: + pwd = os.getcwd() old_sys_path = list(sys.path) if setup.config.plot_working_directory is not None: try: