From b1bdc370cafb155b7b08673fb4aa22df09c9ce96 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 19 Mar 2018 17:43:34 -0700 Subject: [PATCH] scripts/rpc.py: explicitly en/decode socket data This is required to work on Python 3. Change-Id: I1893d967027e3ccebfc6a796dcffa59209d477f9 Signed-off-by: Daniel Verkamp Reviewed-on: https://review.gerrithub.io/404434 Reviewed-by: Paul Luse Tested-by: SPDK Automated Test System Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- scripts/rpc/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/rpc/client.py b/scripts/rpc/client.py index 6c902927b4..26c3031138 100755 --- a/scripts/rpc/client.py +++ b/scripts/rpc/client.py @@ -41,7 +41,7 @@ class JSONRPCClient(object): print("request:") print(json.dumps(req, indent=2)) - self.sock.sendall(reqstr) + self.sock.sendall(reqstr.encode("utf-8")) buf = '' closed = False response = {} @@ -58,7 +58,7 @@ class JSONRPCClient(object): if (newdata == b''): closed = True - buf += newdata + buf += newdata.decode("utf-8") response = json.loads(buf) except socket.timeout: break