[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Fix AttributeError with Python 3.
From:       Günter Milde <milde () lyx ! org>
Date:       2019-02-28 21:59:22
Message-ID: 20190228215922.409852801E1 () lyx ! lyx ! org
[Download RAW message or body]

commit 9abd46b4d5056d11e4b92063aaadd4d5fa73361c
Author: Günter Milde <milde@lyx.org>
Date:   Thu Feb 28 22:59:30 2019 +0100

    Fix AttributeError with Python 3.
    
    At least since Python 3.5, `output` is already a
    (unicode) string and does not have a "decode" method.
---
 lib/scripts/convertDefault.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py
index 8678965..0c9b6a6 100644
--- a/lib/scripts/convertDefault.py
+++ b/lib/scripts/convertDefault.py
@@ -35,7 +35,10 @@ if fout.close() != None:
     output = fout.readline()
     fout.close()
 if not PY2:
-    output = output.decode()
+    # Ensure we have a (unicode) string object in Python3
+    # (not required for version >= 3.5).
+    # FIXME: Check whether this is required with any supported 3.x version!
+    output = str(output)
 
 version = re_version.match(output)
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic