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 <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/fetch.py b/fetch.py
index 285015e..c4b605c 100755
--- a/fetch.py
+++ b/fetch.py
@@ -267,14 +267,14 @@
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