Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df4e10a

Browse files
committed
Merge pull request matplotlib#3594 from wernerfb/UnicodeInitProblem
BUG : Unicode decode error on with unicode username on py2+win
1 parent 638adf4 commit df4e10a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ def _get_home():
506506
:see: http://mail.python.org/pipermail/python-list/2005-February/325395.html
507507
"""
508508
try:
509-
path = os.path.expanduser("~")
509+
if six.PY2 and sys.platform == 'win32':
510+
path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding())
511+
else:
512+
path = os.path.expanduser("~")
510513
except ImportError:
511514
# This happens on Google App Engine (pwd module is not present).
512515
pass

0 commit comments

Comments
 (0)