fix layout2layout with stdin/out for Py3.

sys.stdin and sys.stdout expect a Unicode string,
with bytes we must use sys.std(in|out).buffer.
This commit is contained in:
Günter Milde 2019-07-07 20:37:12 +02:00
parent 0d49918c0c
commit 8556cb1c66

View File

@ -1254,13 +1254,17 @@ def main(argv):
# Open files
if options.input_file:
source = open(options.input_file, 'rb')
else:
elif PY2:
source = sys.stdin
else:
source = sys.stdin.buffer
if options.output_file:
output = open(options.output_file, 'wb')
else:
elif PY2:
output = sys.stdout
else:
output = sys.stdout.buffer
if options.format > currentFormat:
error("Format %i does not exist" % options.format);