From 4e96e3edce5147aba68afde48bbbca61a4560417 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Thu, 27 Feb 2020 11:49:49 +0000 Subject: [PATCH] Use `with` statement to open file --- scripts/bootstrap_history.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap_history.py b/scripts/bootstrap_history.py index dde83dd5c60..87c471a4289 100644 --- a/scripts/bootstrap_history.py +++ b/scripts/bootstrap_history.py @@ -743,8 +743,10 @@ def _releases(): def _github_client(): try: - github_json = os.path.expanduser("~/.github.json") - github = Github(**json.load(open(github_json, "r"))) + github_json_path = os.path.expanduser("~/.github.json") + with open(github_json_path, "r") as fh: + github_json_dict = json.load(fh) + github = Github(**github_json_dict) except Exception: log.exception() github = None