[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/11] analyze-migration.py: fix extract contents ('-x') errors
From: |
Laurent Vivier |
Subject: |
[PULL 11/11] analyze-migration.py: fix extract contents ('-x') errors |
Date: |
Sat, 23 Oct 2021 20:31:23 +0200 |
From: Laurent Vivier <lvivier@redhat.com>
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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211015131645.501281-3-lvivier@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
scripts/analyze-migration.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index 9d239d309f33..b82a1b0c58c4 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -588,7 +588,7 @@ def default(self, o):
dump.read(desc_only = True)
print("desc.json")
- f = open("desc.json", "wb")
+ f = open("desc.json", "w")
f.truncate()
f.write(jsonenc.encode(dump.vmsd_desc))
f.close()
@@ -596,7 +596,7 @@ def default(self, o):
dump.read(write_memory = True)
dict = dump.getDict()
print("state.json")
- f = open("state.json", "wb")
+ f = open("state.json", "w")
f.truncate()
f.write(jsonenc.encode(dict))
f.close()
--
2.31.1
- [PULL 00/11] Trivial branch for 6.2 patches, Laurent Vivier, 2021/10/23
- [PULL 01/11] po: update turkish translation, Laurent Vivier, 2021/10/23
- [PULL 05/11] softmmu/physmem.c: Fix typo in comment, Laurent Vivier, 2021/10/23
- [PULL 09/11] README: Fix some documentation URLs, Laurent Vivier, 2021/10/23
- [PULL 04/11] MAINTAINERS: Add myself as reviewer of 'Machine core' API, Laurent Vivier, 2021/10/23
- [PULL 11/11] analyze-migration.py: fix extract contents ('-x') errors,
Laurent Vivier <=
- [PULL 10/11] analyze-migration.py: fix a long standing typo, Laurent Vivier, 2021/10/23
- [PULL 02/11] disas/nios2: Fix style in print_insn_nios2(), Laurent Vivier, 2021/10/23
- [PULL 03/11] disas/nios2: Simplify endianess conversion, Laurent Vivier, 2021/10/23
- [PULL 06/11] hw/nvram: Fix Memory Leak in Xilinx eFuse QOM, Laurent Vivier, 2021/10/23
- [PULL 08/11] hw/nvram: Fix Memory Leak in Xilinx ZynqMP eFuse device, Laurent Vivier, 2021/10/23
- [PULL 07/11] hw/nvram: Fix Memory Leak in Xilinx Versal eFuse device, Laurent Vivier, 2021/10/23
- Re: [PULL 00/11] Trivial branch for 6.2 patches, Richard Henderson, 2021/10/23