Preparation to support translations with python3

Thanks to José.
This commit is contained in:
Kornel Benko 2015-03-11 20:54:28 +01:00
parent 58b3971eeb
commit da46f6566a
3 changed files with 10 additions and 6 deletions

View File

@ -1,5 +1,7 @@
#! /usr/bin/env python
from __future__ import print_function
# file ReplaceValues.py
#
# This file is part of LyX, the document processor.
@ -32,7 +34,7 @@ def SubstituteDataInLine(line):
def SubstituteDataInFile(InFile):
for line in open(InFile):
print SubstituteDataInLine(line[:-1])
print(SubstituteDataInLine(line[:-1]))
##########################################

View File

@ -1,5 +1,7 @@
#! /usr/bin/env python
from __future__ import print_function
import sys
from getopt import getopt
@ -18,7 +20,7 @@ for (opt, param) in options:
if opt == "-o":
outfile = param
elif opt == "-h":
print usage
print(usage)
sys.exit(0)
out = sys.stdout

View File

@ -4,14 +4,14 @@
import sys
for fname in sys.argv[1:]:
infile = open( fname, "rb" )
infile = open( fname, "r" )
instr = infile.read()
infile.close()
outstr = instr.replace( "\r\n", "\n" ).replace( "\r", "\n" )
if len(outstr) == len(instr):
if outstr == instr:
continue
outfile = open( fname , "wb" )
outfile = open( fname , "w" )
outfile.write( outstr )
outfile.close()
outfile.close()