Merge pull request #8 from nnako/master
FIX: fix Python v2 issues with special characters (e.g. in German)
This commit is contained in:
commit
53503591ad
1 changed files with 3 additions and 3 deletions
|
|
@ -292,7 +292,7 @@ class CodeDiff(object):
|
||||||
self.fromfile = fromfile
|
self.fromfile = fromfile
|
||||||
if fromtxt == None:
|
if fromtxt == None:
|
||||||
try:
|
try:
|
||||||
with open(fromfile) as f:
|
with io.open(fromfile) as f:
|
||||||
self.fromlines = f.readlines()
|
self.fromlines = f.readlines()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Problem reading file %s" % fromfile)
|
print("Problem reading file %s" % fromfile)
|
||||||
|
|
@ -305,7 +305,7 @@ class CodeDiff(object):
|
||||||
self.tofile = tofile
|
self.tofile = tofile
|
||||||
if totxt == None:
|
if totxt == None:
|
||||||
try:
|
try:
|
||||||
with open(tofile) as f:
|
with io.open(tofile) as f:
|
||||||
self.tolines = f.readlines()
|
self.tolines = f.readlines()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Problem reading file %s" % tofile)
|
print("Problem reading file %s" % tofile)
|
||||||
|
|
@ -389,7 +389,7 @@ class CodeDiff(object):
|
||||||
self.htmlContents = HTML_TEMPLATE % answers
|
self.htmlContents = HTML_TEMPLATE % answers
|
||||||
|
|
||||||
def write(self, path):
|
def write(self, path):
|
||||||
fh = open(path, 'w')
|
fh = io.open(path, 'w')
|
||||||
fh.write(self.htmlContents)
|
fh.write(self.htmlContents)
|
||||||
fh.close()
|
fh.close()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue