]> git.lyx.org Git - features.git/commitdiff
ReplaceValues.py: make the file compilable with Python 3
authorUwe Stöhr <uwestoehr@lyx.org>
Mon, 16 Oct 2017 21:29:57 +0000 (23:29 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Mon, 16 Oct 2017 21:29:57 +0000 (23:29 +0200)
see the mailing list thread "compilation of LyX 2.3 fails with Python 3.6.2" for details

development/cmake/doc/ReplaceValues.py

index f07ce80bc9b3953a549848ec166fd3f6b6c7be0f..41ed6e212c51409861a31f8101c95f5fe86128b5 100755 (executable)
@@ -13,6 +13,7 @@ from __future__ import print_function
 
 import sys
 import re
+import codecs
 
 Subst = {}  # map of desired substitutions
 prog = re.compile("")
@@ -33,8 +34,8 @@ def SubstituteDataInLine(line):
 
 
 def SubstituteDataInFile(InFile):
-    for line in open(InFile):
-        print(SubstituteDataInLine(line[:-1]))
+    for line in codecs.open(InFile, 'r', 'utf-8'):
+        print(SubstituteDataInLine(line[:-1]).encode("utf-8"))
 
 ##########################################