From 448a94bd280a7e8030129fd4ee232a7aefafedff Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Mon, 25 Feb 2019 15:20:35 +0100
Subject: [PATCH] [bcp][worker] Decode job data if python older than 3.6

Prior to 3.6 the json module handles only str types. After that
more types are supported out of the box.
---
 beat/core/bcp/worker.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/beat/core/bcp/worker.py b/beat/core/bcp/worker.py
index 2ec25c5f..b0745646 100644
--- a/beat/core/bcp/worker.py
+++ b/beat/core/bcp/worker.py
@@ -183,6 +183,8 @@ def run(
             if command == BCP.BCPE_EXECUTE:
                 job_id = request.pop(0)
                 job_data = request.pop(0)
+                if sys.version_info < (3, 6):
+                    job_data = job_data.decode("utf-8")
                 data = json.loads(job_data)
 
                 reply = [BCP.BCPP_JOB_RECEIVED, job_id]
-- 
GitLab