Skip to content
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

UnicodeDecodeError when I try to import matplotlib from directory with non-ascii name #3618

Closed
macie opened this issue Oct 4, 2014 · 3 comments
Milestone

Comments

@macie
Copy link

macie commented Oct 4, 2014

In linux:

user@machine:~$ cd ściółka
user@machine:~/ściółka$ python
Python 2.7.8 (default, Sep 24 2014, 18:26:21) 
>>> import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.virtualenvs/env/lib/python2.7/site-packages/matplotlib/__init__.py", line 1048, in <module>
    rcParams = rc_params()
  File "/home/user/.virtualenvs/env/lib/python2.7/site-packages/matplotlib/__init__.py", line 897, in rc_params
    fname = matplotlib_fname()
  File "/home/user/.virtualenvs/env/lib/python2.7/site-packages/matplotlib/__init__.py", line 748, in matplotlib_fname
    fname = os.path.join(os.getcwd(), 'matplotlibrc')
  File "/home/user/.virtualenvs/env/lib/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 36: ordinal not in range(128)
>>>

I don't know what is better to use to decoding path: sys.getfilesystemencoding() or locale.getdefaultlocale()[1]?

@tacaswell tacaswell added this to the v1.4.x milestone Oct 4, 2014
@tacaswell
Copy link
Member

What version of mpl is this with?

Can you try with the 1.4.x branch? There have been a number of bugs fixed related to unicode paths recently.

@macie
Copy link
Author

macie commented Oct 4, 2014

matplotlib installed today with pip:

$ pip freeze
...
matplotlib==1.4.0
...

@macie
Copy link
Author

macie commented Oct 5, 2014

After quick research I found commit which resolves the problem: 0a41d83

@tacaswell Thanks for quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants