Fwd: String/Bytes Problem in layout2layout.py

Pavel Sanda sanda at lyx.org
Mon Jan 3 14:55:53 UTC 2022


On Mon, Jan 03, 2022 at 02:04:20PM +0000, José Abílio Matos wrote:
> Looking into further detail I would easily that the first part of the patch is 
> correct (change "..." to b"...").
> 
> The second part where it changes sys.stdin to sys.stdin.buffer is probably 
> incorrect:
> 
> The similar code in 2.4 is:
>     # Open files
>     if options.input_file:
>         source = open(options.input_file, 'rb')
>     elif PY2:
>         source = sys.stdin
>     else:
>         source = sys.stdin.buffer
> 
>     if options.output_file:
>         output = open(options.output_file, 'wb')
>     elif PY2:
>         output = sys.stdout
>     else:
>         output = sys.stdout.buffer
> 
> So this should be the right change, keep the previous form if PY2 (python 2 is 
> used) else use the new call.

If I get that right the part of the "..." -> b"..." should be committed to 2.4?

Pavel


More information about the lyx-devel mailing list