]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Python3 porting: read/write uniciode files.
authorrnv <rnv@opencascade.com>
Fri, 19 May 2017 12:31:00 +0000 (15:31 +0300)
committerrnv <rnv@opencascade.com>
Fri, 19 May 2017 12:31:00 +0000 (15:31 +0300)
tools/dlgfactory/dlgfactory.py

index 96b8dc4bf0d5c8e6411b07b1fa7c45ed21506b96..5b0c89975dfec7817e2c315260bd8acbe0b52f9d 100755 (executable)
@@ -81,7 +81,7 @@ salomeinclude_HEADERS       += __CLASSNAME__.h
 
 if __name__ == "__main__":
   from optparse import OptionParser
-  import shutil, fileinput
+  import codecs
 
   tool_path = os.path.dirname( os.path.abspath( sys.argv[0] ) )
 
@@ -108,12 +108,13 @@ if __name__ == "__main__":
     else:
       file_src = os.path.join( tool_path, "__GDIALOG__" + ext )
       pass
-    shutil.copyfile( file_src, file_dest )
-    finput = fileinput.FileInput( file_dest, inplace=1 )
-    for line in finput:
+    fi = codecs.open(file_src, 'r', encoding='utf-8')
+    fo = codecs.open(file_dest, 'w', encoding='utf-8')
+    for line in fi:
       line = line[:-1] 
       line = line.replace( "__CLASSNAME__", className )
-      print(line)
+      line = line + "\n"
+      fo.write(line)
       pass
 
     if options.verbose: