From e2686734ac512e681f788248df0797bbbcb76a55 Mon Sep 17 00:00:00 2001 From: Milad Farazmand Date: Fri, 17 Apr 2020 17:52:50 +0000 Subject: [PATCH] Make fetch compatible with py 3.5 Running `fetch v8` with Python 3.5 produces the following error: TypeError: the JSON object must be str, not 'bytes' Adding `.decode("utf-8")` makes it compatible with both versions. Change-Id: Ib0699b61b24f191559c30f1e7ca8d2c919803d03 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2154108 Reviewed-by: Edward Lesmes Commit-Queue: Edward Lesmes --- fetch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fetch.py b/fetch.py index 285015e90f..c4b605c665 100755 --- a/fetch.py +++ b/fetch.py @@ -267,14 +267,14 @@ def run_config_fetch(config, props, aliased=False): cmd = [sys.executable, config_path + '.py', 'fetch'] + props result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - spec = json.loads(result) + spec = json.loads(result.decode("utf-8")) if 'alias' in spec: assert not aliased return run_config_fetch( spec['alias']['config'], spec['alias']['props'] + props, aliased=True) cmd = [sys.executable, config_path + '.py', 'root'] result = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] - root = json.loads(result) + root = json.loads(result.decode("utf-8")) return spec, root