From: Günter Milde Date: Sun, 7 Jul 2019 18:37:12 +0000 (+0200) Subject: fix layout2layout with stdin/out for Py3. X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ec804337185890219acd1e571da2146b3d16d8b3;p=features.git 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. --- diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index 5e9d3483de..af2a851550 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -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);