On 2019-02-26, Stephan Witt wrote:
> Am 26.02.2019 um 13:15 schrieb Guenter Milde <mi...@users.sf.net>:
>> On 2019-02-26, Stephan Witt wrote:
>>> Am 26.02.2019 um 09:06 schrieb Guenter Milde <mi...@users.sf.net>:
>>>> On 2019-02-26, Stephan Witt wrote:

...

>>>>> Traceback (most recent call last):
>>>>> File "/Users/stephan/git/lyx/lib/scripts/convertDefault.py", line 38, in 
>>>>> <module>
>>>>>   output = output.decode()
>>>>> AttributeError: 'str' object has no attribute 'decode'

...

>> I suppose that the unpatched code is correct with older Py3 versions, where
>> `os.popen()` may have returned a bytes-string but the regexp-match a
>> unicode-string and no implicit conversion is done.

...

> The change 5b160e82be3 is to blame for this piece of code and is by José.
> His intention was it to prepare the scripts for the transition to Python 3.
> Probably he wants to comment on this or improve it further. ;-)

Could you test the following workaround, please?
This should help to ensure we have a (unicode) string object in Python3
without doing harm in other cases.

Günter


diff --git a/lib/scripts/convertDefault.py b/lib/scripts/convertDefault.py
index 8678965013..c7db4f5499 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
+    # FIXME: not required for version >= 3.5
+    #        check whether this is required with any supported 3.x version!
+    output = str(output)
 
 version = re_version.match(output)
 


Reply via email to