diff mbox series

[1/2] analyze-migration.py: fix find() type error

Message ID 20191127101038.327080-2-marcandre.lureau@redhat.com
State New
Headers show
Series analyze-migration.py: require python 3 | expand

Commit Message

Marc-André Lureau Nov. 27, 2019, 10:10 a.m. UTC
Traceback (most recent call last):
  File "../scripts/analyze-migration.py", line 611, in <module>
    dump.read(desc_only = True)
  File "../scripts/analyze-migration.py", line 513, in read
    self.load_vmsd_json(file)
  File "../scripts/analyze-migration.py", line 556, in load_vmsd_json
    vmsd_json = file.read_migration_debug_json()
  File "../scripts/analyze-migration.py", line 89, in read_migration_debug_json
    nulpos = data.rfind("\0")
TypeError: argument should be integer or bytes-like object, not 'str'

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 scripts/analyze-migration.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Eduardo Habkost Nov. 27, 2019, 11:37 p.m. UTC | #1
On Wed, Nov 27, 2019 at 02:10:37PM +0400, Marc-André Lureau wrote:
> Traceback (most recent call last):
>   File "../scripts/analyze-migration.py", line 611, in <module>
>     dump.read(desc_only = True)
>   File "../scripts/analyze-migration.py", line 513, in read
>     self.load_vmsd_json(file)
>   File "../scripts/analyze-migration.py", line 556, in load_vmsd_json
>     vmsd_json = file.read_migration_debug_json()
>   File "../scripts/analyze-migration.py", line 89, in read_migration_debug_json
>     nulpos = data.rfind("\0")
> TypeError: argument should be integer or bytes-like object, not 'str'
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Thanks!  I'm queueing this, but I'm hoping we don't have a -rc4
and 4.2.0 gets released next week.
diff mbox series

Patch

diff --git a/scripts/analyze-migration.py b/scripts/analyze-migration.py
index e527eb168e..2b835d9b70 100755
--- a/scripts/analyze-migration.py
+++ b/scripts/analyze-migration.py
@@ -86,8 +86,8 @@  class MigrationFile(object):
 
         # Find the last NULL byte, then the first brace after that. This should
         # be the beginning of our JSON data.
-        nulpos = data.rfind("\0")
-        jsonpos = data.find("{", nulpos)
+        nulpos = data.rfind(b'\0')
+        jsonpos = data.find(b'{', nulpos)
 
         # Check backwards from there and see whether we guessed right
         self.file.seek(datapos + jsonpos - 5, 0)