8000 Can not import matplotlib when launching from non-ascii path by mdboom · Pull Request #3487 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Can not import matplotlib when launching from non-ascii path #3487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
0