From cf7ec54f232d4d274e0c865a16f9032d43fda769 Mon Sep 17 00:00:00 2001 From: Chris Blumentritt Date: Sun, 30 Dec 2018 23:52:23 -0600 Subject: [PATCH] Script can now load the data.json file when invoked from different directory If the script is run from a different directory than the where it resides then it would fail to load because it could not find data.json. fixes #47 --- sherlock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sherlock.py b/sherlock.py index f59d28b..3e6073f 100644 --- a/sherlock.py +++ b/sherlock.py @@ -90,7 +90,8 @@ def sherlock(username, verbose=False, tor=False, unique_tor=False): } # Load the data - with open("data.json", "r", encoding="utf-8") as raw: + script_directory = os.path.dirname(os.path.realpath(__file__)) + with open(script_directory + "/data.json", "r", encoding="utf-8") as raw: data = json.load(raw) # Allow 1 thread for each external service, so `len(data)` threads total