Close when opened as module

This commit is contained in:
Frisk 2019-02-13 00:10:54 +01:00
parent c094986642
commit 6dddf4c685
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -26,6 +26,10 @@ from collections import defaultdict, Counter
from urllib.parse import quote_plus from urllib.parse import quote_plus
from html.parser import HTMLParser from html.parser import HTMLParser
if __name__ != "__main__":
logging.critical("The file is being executed as a module. Please execute the script using the console.")
sys.exit(1)
try: try:
with open("settings.json") as sfile: with open("settings.json") as sfile:
settings = json.load(sfile) settings = json.load(sfile)