From 616f473b8fbe07e5dea0810304df17c356d012c3 Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Mon, 29 Sep 2014 20:29:29 +0200 Subject: [PATCH 1/2] =?UTF-8?q?-=20Unicode=20decode=20error=20due=20to=20s?= =?UTF-8?q?pecial=20characters=20(e.g.=20=C3=BC=C3=B6=20etc)=20in=20users?= =?UTF-8?q?=20home=20dir=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/matplotlib/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index af19121adcae..b173aa1a8566 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -523,7 +523,7 @@ def _get_home(): http://mail.python.org/pipermail/python-list/2005-February/325395.html """ try: - path = os.path.expanduser("~") + path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding()) except ImportError: # This happens on Google App Engine (pwd module is not present). pass From dd7f7c05699f0fa30c4157d6482654745b824d0f Mon Sep 17 00:00:00 2001 From: Werner F Bruhin Date: Mon, 29 Sep 2014 21:14:47 +0200 Subject: [PATCH 2/2] - only do it on Windows and Python 2.x, as per Michael's comment --- lib/matplotlib/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index b173aa1a8566..d0ab7bff9877 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -523,7 +523,10 @@ def _get_home(): http://mail.python.org/pipermail/python-list/2005-February/325395.html """ try: - path = os.path.expanduser(b"~").decode(sys.getfilesystemencoding()) + 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