python: Help Python 2 print the line
Reviewed-by: Jose Fonseca <jfonseca@vmware>
This commit is contained in:
committed by
Brian Paul
parent
a8ef7f5e02
commit
f9415d760a
@@ -218,6 +218,11 @@ for line in template:
|
||||
assert len(descMatches) == 0
|
||||
descMatches = [matchDESC_BEGIN]
|
||||
else:
|
||||
# In Python 2, stdout expects encoded byte strings, or else it will
|
||||
# encode them with the ascii 'codec'
|
||||
if sys.version_info.major == 2:
|
||||
line = line.encode('utf-8')
|
||||
|
||||
print(line, end='')
|
||||
|
||||
template.close()
|
||||
|
||||
Reference in New Issue
Block a user