scripts/analyze-migration: Make it work in Python 3
PATCH RESEND 1/1 scripts/analyze-migration: Make it work in Python 3
Currently crashing on Python 3 with:
$ scripts/analyze-migration.py -m -f vm.state
TypeError: ord() expected string of length 1, but int foundSigned-off-by Pawel Zmarzly <[email protected]>
--- scripts/analyze-migration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/analyze-migration.py +2 -2
@@ -56,7 +56,7 @@ def readvar(self, size = None): if size is None: size = self.read8() if size == 0: - return "" + return b"" value = self.file.read(size) if len(value) != size: raise Exception("Unexpected end of %s at 0x%x" % (self.filename, self.file.tell()))
@@ -200,7 +200,7 @@ def read(self): self.files[self.name].seek(addr, os.SEEK_SET) self.files[self.name].write(data) if self.dump_memory: - hexdata = " ".join("{0:02x}".format(ord(c)) for c in data) + hexdata = " ".join("{0:02x}".format(c) for c in data) self.memory['%s (0x%016x)' % (self.name, addr)] = hexdata flags &= ~self.RAM_SAVE_FLAG_PAGE
Signature · 1 line
2.51.1