From eee12b9b6684224ba0739e59634f7d6bc47e8069 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 29 Feb 2020 21:59:10 +0200 Subject: [PATCH] Fixed an issue "the JSON object must be str, not 'bytes'" when PIO Home is used with Python 3.5 // Resolve #3396 --- HISTORY.rst | 1 + platformio/commands/home/rpc/handlers/piocore.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 51dd797a..172f7bee 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -10,6 +10,7 @@ PlatformIO Core 4 ~~~~~~~~~~~~~~~~~~ * Fixed an issue when quitting from PlatformIO IDE does not shutdown PIO Home server +* Fixed an issue "the JSON object must be str, not 'bytes'" when PIO Home is used with Python 3.5 (`issue #3396 `_) 4.2.1 (2020-02-17) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/commands/home/rpc/handlers/piocore.py b/platformio/commands/home/rpc/handlers/piocore.py index 9ef39a03..41009c4e 100644 --- a/platformio/commands/home/rpc/handlers/piocore.py +++ b/platformio/commands/home/rpc/handlers/piocore.py @@ -146,6 +146,8 @@ class PIOCoreRPC(object): raise Exception(text) if not to_json: return text + if is_bytes(out): + out = out.decode() try: return json.loads(out) except ValueError as e: