Skip to content

Commit 95a9ef8

Browse files
committed
Merge pull request #3594 from wernerfb/UnicodeInitProblem
BUG : Unicode decode error on with unicode username on py2+win
2 parents c439104 + dd7f7c0 commit 95a9ef8

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
@@ -523,7 +523,10 @@ def _get_home():
523523
http://mail.python.org/pipermail/python-list/2005-February/325395.html
524524
"""
525525
try:
526-
path = os.path.expanduser("~")
526+
if six.PY2 and sys.platform == 'win32':
527+
path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding())
528+
else:
529+
path = os.path.expanduser("~")
527530
except ImportError:
528531
# This happens on Google App Engine (pwd module is not present).
529532
pass

0 commit comments

Comments
 (0)