diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 8a20272636f0..75582f2ad43e 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -506,7 +506,10 @@ def _get_home(): :see: http://mail.python.org/pipermail/python-list/2005-February/325395.html """ try: - path = os.path.expanduser("~") + if six.PY2 and sys.platform == 'win32': + path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding()) + else: + path = os.path.expanduser("~") except ImportError: # This happens on Google App Engine (pwd module is not present). pass