From f7babb8d6d435a37514f2e59b54787c31607ca06 Mon Sep 17 00:00:00 2001 From: Joseph Snyder Date: Tue, 1 Oct 2019 10:09:20 -0400 Subject: [PATCH] Additional fixes for opening files with codecs --- Scripts/PackRO.py | 3 ++- Scripts/PrepareMComponentsForImport.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Scripts/PackRO.py b/Scripts/PackRO.py index ed8194fe7..bba86587a 100755 --- a/Scripts/PackRO.py +++ b/Scripts/PackRO.py @@ -22,6 +22,7 @@ # See the License for the specific language governing permissions and # limitations under the License. #--------------------------------------------------------------------------- +import codecs import sys import os @@ -33,7 +34,7 @@ def pack(files, output): continue n = os.path.basename(f)[:-2] n = n.replace("_","%") - m = open(f,"r") + m = codecs.open(f,"r", 'ISO-8859-1', 'ignore') output.write('%s\n'%n) for line in m: output.write(line) diff --git a/Scripts/PrepareMComponentsForImport.py b/Scripts/PrepareMComponentsForImport.py index 64e026940..00f92b37a 100644 --- a/Scripts/PrepareMComponentsForImport.py +++ b/Scripts/PrepareMComponentsForImport.py @@ -14,6 +14,7 @@ # limitations under the License. #--------------------------------------------------------------------------- from __future__ import print_function +import codecs import sys import os import PackRO @@ -38,8 +39,8 @@ def files_in_tree(pattern, top): except OSError: pass -routputfile = open(os.path.join(result.outputdir,"routines.ro"),'w') -goutputfile = open(os.path.join(result.outputdir,"globals.lst"),'w') +routputfile = codecs.open(os.path.join(result.outputdir,"routines.ro"), 'w', 'ISO-8859-1', 'ignore') +goutputfile = codecs.open(os.path.join(result.outputdir,"globals.lst"), 'w', 'ISO-8859-1', 'ignore') routines=[] globals=[]