From bd97ea1c82d04db405c72a2b87639e907a827086 Mon Sep 17 00:00:00 2001 From: cclauss Date: Fri, 7 Dec 2018 10:10:55 +0100 Subject: [PATCH] tools: prepare ./tools/compress_json.py for Python 3 PR-URL: https://github.com/nodejs/node/pull/24889 Reviewed-By: Rich Trott Reviewed-By: Richard Lau --- tools/compress_json.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/compress_json.py b/tools/compress_json.py index 34dbb878c48a27..b52c5d7a252cf6 100644 --- a/tools/compress_json.py +++ b/tools/compress_json.py @@ -5,6 +5,12 @@ import sys import zlib +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + + if __name__ == '__main__': fp = open(sys.argv[1]) obj = json.load(fp)