[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 2/2] analyze-migration.py: fix extract contents ('-x') errors |
Date: |
Fri, 15 Oct 2021 16:21:01 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 |
On 10/15/21 15:16, Laurent Vivier wrote:
> When we try to use 'analyze-migration.py -x' with python3,
> we have the following errors:
>
> Traceback (most recent call last):
> File "scripts/analyze-migration.py", line 593, in <module>
> f.write(jsonenc.encode(dump.vmsd_desc))
> TypeError: a bytes-like object is required, not 'str'
>
> Traceback (most recent call last):
> File "scripts/analyze-migration.py", line 601, in <module>
> f.write(jsonenc.encode(dict))
> TypeError: a bytes-like object is required, not 'str'
>
> This happens because the file 'f' is open in binary mode while
> jsonenc.encode() returns a string.
>
> The results are human-readable files, 'desc.json' and 'state.json',
> so there is no reason to use the binary mode.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> scripts/analyze-migration.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>