From a383626effdc1afc4d8bacee2ff4089bf1aa4e6c 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 (cherry picked from commit ad7ddfbca1a07d743dfbfbfc6c2ca748c9e77cbe) --- 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)