From 28bdb22c897b9193a3984525e1ddaf1a4ea4ae7a Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 25 Jun 2018 09:39:57 -0700 Subject: [PATCH] Fixed issue when sys.prefix is not unicode (Python2) and when its contents are not translatable to utf-8. (cherry picked from commit 3e88095c5372b9ff8a6ba3f4478f5405658d81fb) --- CHANGES.rst | 3 +++ etg/app.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index b5be1353..aa99499a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -70,6 +70,9 @@ Changes in this release include the following: passing it to a window constructor, and can also be used as the source in a Bind(). +* Fixed issue when sys.prefix is not unicode (Python2) and when its contents + are not translatable to utf-8. + 4.0.2 "Cute as a June bug!" diff --git a/etg/app.py b/etg/app.py index 456bedc0..f798ce90 100644 --- a/etg/app.py +++ b/etg/app.py @@ -419,7 +419,10 @@ def run(): self.RedirectStdio(filename) # Use Python's install prefix as the default - wx.StandardPaths.Get().SetInstallPrefix(_sys.prefix) + prefix = _sys.prefix + if isinstance(prefix, (bytes, bytearray)): + prefix = prefix.decode(_sys.getfilesystemencoding()) + wx.StandardPaths.Get().SetInstallPrefix(prefix) # Until the new native control for wxMac is up to par, still use the generic one. wx.SystemOptions.SetOption("mac.listctrl.always_use_generic", 1)