Closed
Description
Ahoy!
I have recently updated matplotlib through conda to version 14.0
(np19py27_0
).
I am using windows 8, python 2.7.7 (Anaconda distribution 2.0.2 32-bit)
Unfortunatelly my windows user name contains non-ascii caracter (ś
) and importing matplotlib gives errors. 😢 (previous matplotlib versions I used did not have any problem with this)
The error comes in two flavors:
⚫ If my current working directory contains non-ascii character then:
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-1-82be63b7783c> in <module>()
----> 1 import matplotlib
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in <module>()
1046
1047 # this is the instance used by the matplotlib classes
-> 1048 rcParams = rc_params()
1049
1050 if rcParams['examples.directory']:
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in rc_params(fail_on_error)
895 default matplotlib rc file.
896 """
--> 897 fname = matplotlib_fname()
898 if not os.path.exists(fname):
899 # this should never happen, default in mpl-data should always be found
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in matplotlib_fname()
746 system-defined copy.
747 """
--> 748 fname = os.path.join(os.getcwd(), 'matplotlibrc')
749 if os.path.exists(fname):
750 return fname
D:\Python\Anaconda\lib\ntpath.pyc in join(path, *paths)
82 if result_path and result_path[-1] not in '\\/':
83 result_path = result_path + '\\'
---> 84 result_path = result_path + p_path
85 return result_drive + result_path
86
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 11: ordinal not in range(128)
⚫ If I change my current directory so that it does not contain any ascii characters the error transforms itself a little:
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-6-1d1446f6fa64> in <module>()
----> 1 from matplotlib import pyplot as plt
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in <module>()
1046
1047 # this is the instance used by the matplotlib classes
-> 1048 rcParams = rc_params()
1049
1050 if rcParams['examples.directory']:
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in rc_params(fail_on_error)
895 default matplotlib rc file.
896 """
--> 897 fname = matplotlib_fname()
898 if not os.path.exists(fname):
899 # this should never happen, default in mpl-data should always be found
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in matplotlib_fname()
757 return fname
758
--> 759 configdir = _get_configdir()
760 if configdir is not None:
761 fname = os.path.join(configdir, 'matplotlibrc')
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in _get_configdir()
628 5. A writable directory could not be found or created; return None.
629 """
--> 630 return _get_config_or_cache_dir(_get_xdg_config_dir())
631
632 get_configdir = verbose.wrap('CONFIGDIR=%s', _get_configdir, always=False)
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in _get_xdg_config_dir()
553 path = os.environ.get('XDG_CONFIG_HOME')
554 if path is None:
--> 555 path = get_home()
556 if path is not None:
557 path = os.path.join(path, '.config')
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in wrapper(*args, **kwargs)
321 assert six.callable(func)
322 def wrapper(*args, **kwargs):
--> 323 ret = func(*args, **kwargs)
324
325 if (always or not wrapper._spoke):
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in _get_home()
507 """
508 try:
--> 509 path = os.path.expanduser("~")
510 except ImportError:
511 # This happens on Google App Engine (pwd module is not present).
D:\Python\Anaconda\lib\ntpath.pyc in expanduser(path)
271 userhome = join(dirname(userhome), path[1:i])
272
--> 273 return userhome + path[i:]
274
275
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 13: ordinal not in range(128)