]> git.lyx.org Git - features.git/commitdiff
fix layout2layout with stdin/out for Py3.
authorGünter Milde <milde@lyx.org>
Sun, 7 Jul 2019 18:37:12 +0000 (20:37 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:35 +0000 (15:48 +0200)
sys.stdin and sys.stdout expect a Unicode string,
with bytes we must use sys.std(in|out).buffer.

lib/scripts/layout2layout.py

index 5e9d3483dee51f3871fcc7dd7ba3ef9b889ee765..af2a85155042fcc15cedc60886b308dbf9079445 100644 (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);