From 10582b629ec520611b633afa005a47e82340b27c Mon Sep 17 00:00:00 2001 From: Simeon Visser Date: Tue, 25 Dec 2018 20:17:39 +0000 Subject: [PATCH] Ensure raw file is automatically closed --- sherlock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sherlock.py b/sherlock.py index 79d8abe..4f6796a 100644 --- a/sherlock.py +++ b/sherlock.py @@ -30,8 +30,8 @@ def main(): print("\033[1;92m[\033[0m\033[1;77m*\033[0m\033[1;92m] Checking username\033[0m\033[1;37m {}\033[0m\033[1;92m on: \033[0m".format(username)) - raw = open("data.json", "r") - data = json.load(raw) + with open("data.json", "r") as raw: + data = json.load(raw) # User agent is needed because some sites does not # return the correct information because it thinks that