Fix unicode output issues
Clean up minor python3 compatibility problems.
This commit is contained in:
parent
e040c5742d
commit
e565103749
1 changed files with 9 additions and 5 deletions
|
@ -98,7 +98,7 @@ def parse_config(file):
|
||||||
section_string = ','.join(section_list)
|
section_string = ','.join(section_list)
|
||||||
if error == False:
|
if error == False:
|
||||||
error = 'Missing value or section.'
|
error = 'Missing value or section.'
|
||||||
print ','.join(section_list), '=', error
|
print(','.join(section_list), '=', error)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return cfg['global']
|
return cfg['global']
|
||||||
|
@ -316,11 +316,15 @@ def write_html(loader, template, data, dir, fname):
|
||||||
path = os.path.join(dir, fname)
|
path = os.path.join(dir, fname)
|
||||||
try:
|
try:
|
||||||
f = open(path, "w")
|
f = open(path, "w")
|
||||||
except IOError, (err, strerr):
|
except:
|
||||||
print 'ERROR: %s: %s' % (strerr, path)
|
print("Error opening %s" % (path))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
f.write(output.render())
|
for line in output.render().splitlines():
|
||||||
|
try:
|
||||||
|
f.write(line.encode('utf8'))
|
||||||
|
except UnicodeError as e:
|
||||||
|
print(e.encoding, e.reason, e.object)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
# Selection functions (should all be predicates)
|
# Selection functions (should all be predicates)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue