|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v20210701 06/40] tools: fix Python3.4 TypeError in format string
Using the first element of a tuple for a format specifier fails with
python3.4 as included in SLE12:
b = b"string/%x" % (i, )
TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'
It happens to work with python 2.7 and 3.6.
Use a syntax that is handled by all three variants.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
tools/python/scripts/convert-legacy-stream | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/python/scripts/convert-legacy-stream
b/tools/python/scripts/convert-legacy-stream
index 9003ac4f6d..235b922ff5 100755
--- a/tools/python/scripts/convert-legacy-stream
+++ b/tools/python/scripts/convert-legacy-stream
@@ -347,9 +347,9 @@ def read_libxl_toolstack(vm, data):
if nil != 0:
raise StreamError("physmap name not NUL terminated")
- root = b"physmap/%x" % (phys, )
- kv = [root + b"/start_addr", b"%x" % (start, ),
- root + b"/size", b"%x" % (size, ),
+ root = bytes(("physmap/%x" % phys).encode('utf-8'))
+ kv = [root + b"/start_addr", bytes(("%x" % start).encode('utf-8')),
+ root + b"/size", bytes(("%x" % size).encode('utf-8')),
root + b"/name", name]
for key, val in zip(kv[0::2], kv[1::2]):
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |