-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
BUG : skip looking up expanduser if unicode error #3532
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
Conversation
closes matplotlib#3516 by ignoring the real problem. The real problem seems to be in the core libary ( http://bugs.python.org/issue13207) to which the response was 'upgrade to python 3'.
@mmagnuski Can you test this to see if it fixes your problem? I don't have a windows machine handy... |
Perhaps, a warning should be added about it being ignored and suggest python3 if the user home path must be used and is not completely ascii |
On the other hand, that is a set of things that are unlikely to change quickly and we would just be spamming the users with a redundant warning every time they start up. On the other-other hand it would head off the 'mpl is not reading my rcparams' bug reports. |
I added the lines to ---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-1-048e35a72bec> in <module>()
----> 1 import matplotlib as mpl
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in <module>()
1049
1050 # this is the instance used by the matplotlib classes
-> 1051 rcParams = rc_params()
1052
1053 if rcParams['examples.directory']:
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in rc_params(fail_on_error)
898 default matplotlib rc file.
899 """
--> 900 fname = matplotlib_fname()
901 if not os.path.exists(fname):
902 # this should never happen, default in mpl-data should always be found
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in matplotlib_fname()
749 system-defined copy.
750 """
--> 751 fname = os.path.join(os.getcwd(), 'matplotlibrc')
752 if os.path.exists(fname):
753 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 to all-ascii the error is: ---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-7-048e35a72bec> in <module>()
----> 1 import matplotlib as mpl
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in <module>()
1049
1050 # this is the instance used by the matplotlib classes
-> 1051 rcParams = rc_params()
1052
1053 if rcParams['examples.directory']:
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in rc_params(fail_on_error)
898 default matplotlib rc file.
899 """
--> 900 fname = matplotlib_fname()
901 if not os.path.exists(fname):
902 # this should never happen, default in mpl-data should always be found
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in matplotlib_fname()
760 return fname
761
--> 762 configdir = _get_configdir()
763 if configdir is not None:
764 fname = os.path.join(configdir, 'matplotlibrc')
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in _get_configdir()
631 5. A writable directory could not be found or created; return None.
632 """
--> 633 return _get_config_or_cache_dir(_get_xdg_config_dir())
634
635 get_configdir = verbose.wrap('CONFIGDIR=%s', _get_configdir, always=False)
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in _get_xdg_config_dir()
556 path = os.environ.get('XDG_CONFIG_HOME')
557 if path is None:
--> 558 path = get_home()
559 if path is not None:
560 path = os.path.join(path, '.config')
D:\Python\Anaconda\lib\site-packages\matplotlib\__init__.py in wrapper(*args, **kwargs)
324
325 if (always or not wrapper._spoke):
--> 326 spoke = self.report(fmt%ret, level)
327 if not wrapper._spoke: wrapper._spoke = spoke
328 return ret
UnicodeDecodeError: 'ascii' codec can't decode byte 0x9c in position 13: ordinal not in range(128) |
@mmagnuski: I think you're now running into #3487, which is fixed on the maintenance branch but not in any release yet. |
There are a couple of alternative solutions suggested here: https://stackoverflow.com/questions/23888120/an-alternative-to-os-path-expanduser Great if that works. I'm wary of including a lot of very low-level and platform-specific code, though, particularly since Windows gets so little testing as it is... |
Closing in favor of #3594 which actually fixes the problem instead of ignoring it. |
closes #3516 by ignoring the real problem.
The real problem seems to be in the core libary (
http://bugs.python.org/issue13207) to which the response was
'upgrade to python 3'.