[X2Go-Commits] [python-x2go] 01/01: x2go/log.py: Fix exception triggered in Python2'ish pyhoca-gui due to wrong string encoding stemming for Python X2Go's logger code.

git-admin at x2go.org git-admin at x2go.org
Wed Nov 20 08:04:04 CET 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository python-x2go.

commit 8a0d34aa690b0f73e549e4ce61e4a0ecefd51dfa
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Nov 20 08:02:19 2019 +0100

    x2go/log.py: Fix exception triggered in Python2'ish pyhoca-gui due to wrong string encoding stemming for Python X2Go's logger code.
---
 x2go/log.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/x2go/log.py b/x2go/log.py
index eec4adf..6de5d28 100644
--- a/x2go/log.py
+++ b/x2go/log.py
@@ -99,12 +99,13 @@ class X2GoLogger(object):
         if loglevel & self.loglevel:
 
             msg = msg.replace('\n', ' ')
-            msg = msg.encode(utils.get_encoding())
+            if sys.version_info[0] < 3:
+                msg = msg.decode(utils.get_encoding())
 
             if self.tag is not None:
-                self.destination.write(u'%s[%s] (%s) %s: %s\n' % (self.name, self.progpid, tag, self._loglevel_NAMES[loglevel].upper(), msg.decode()))
+                self.destination.write(u'%s[%s] (%s) %s: %s\n' % (self.name, self.progpid, tag, self._loglevel_NAMES[loglevel].upper(), msg))
             else:
-                self.destination.write(u'%s[%s] %s: %s\n' % (self.name, self.progpid, self._loglevel_NAMES[loglevel].upper(), msg.decode()))
+                self.destination.write(u'%s[%s] %s: %s\n' % (self.name, self.progpid, self._loglevel_NAMES[loglevel].upper(), msg))
     __call__ = message
 
     def get_loglevel(self):

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/python-x2go.git


More information about the x2go-commits mailing list