From c9722abf766db4bc9548998a3f2e995f0923178d Mon Sep 17 00:00:00 2001 From: rozetko Date: Thu, 5 Jul 2018 15:15:28 +0300 Subject: [PATCH] Fix analytics error "the JSON object must be str, not 'bytes'" --- analytics/server.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/analytics/server.py b/analytics/server.py index b4aa276..1c10dae 100644 --- a/analytics/server.py +++ b/analytics/server.py @@ -52,9 +52,10 @@ if __name__ == "__main__": logger.info("Ok") while True: - text = socket.recv() + received_bytes = socket.recv() + text = received_bytes.decode('utf-8') logger.info('Got message %s' % text) - if text == b'ping': + if text == 'ping': handlePing() logger.info('Sent pong') else: