#735 Fix encoding issue in runroot with python3
Closed by mikem. Opened by puiterwijk.
puiterwijk/koji py3-runroot-encoding  into  master

Download 735.patch

This will make sure that the log from the server is correctly decoded, since
sys.stdout only accepts strings, not raw bytes, which is what downloadTaskOutput
returns.

Signed-off-by: Patrick Uiterwijk patrick@puiterwijk.org

I have tested this on both py2 and py3, and it works as expected and fixes the following output with py3 koji runroot:

23558770
TypeError: write() argument must be str, not bytes

comment so I can follow status of this PR

I'm not sure this is quite correct in the py2 case.

I was about to suggest using _fix_print(), but I think this runroot output is a special case.

The runroot.log output is generated by an arbitrary command in a buildroot. It could be anything. The intent of the runroot command output is to be a direct pass through, so we could like to avoid any translation of the output if we can help it. We basically just want to cat this file.

I wonder if we should has do something like:

    if six.PY3:
        sys.stdout.buffer.write(log)
    else: ...

Alternate solution: PR#828

merged #828, closing this one

Pull-Request has been closed by mikem

Metadata