qmp.py: Encode json data before sending
commit7e2b34f26e2c25e94974e37974bc683dce5f8757
authorEduardo Habkost <ehabkost@redhat.com>
Mon, 12 Mar 2018 18:55:02 +0000 (12 15:55 -0300)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 12 Mar 2018 22:10:16 +0000 (12 19:10 -0300)
treeb2e430ae0966922f236c29fb0eda22e4b3ded29c
parentfb2e1cc6c45fd69082a4793a662778c7a747c452
qmp.py: Encode json data before sending

On Python 3, json.dumps() return a str object, which can't be
sent directly through a socket and must be encoded into a bytes
object.  Use .encode('utf-8'), which will work on both Python 2
and Python 3.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20180312185503.5746-3-ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
scripts/qmp/qmp.py