import hashlib import os import sys from json import loads import uuid def uuid_from_string(string:str): hex_string = hashlib.md5(string.encode("utf8")).hexdigest() return uuid.UUID(hex=hex_string) def app_dir(): return os.path.dirname(os.path.abspath(__file__)) def load_config(config_name): try: path = os.path.join(app_dir(), config_name) print("Looking config file", path) with open(path, "r", encoding="utf8") as f: return loads(f.read()) except Exception as e: print("cannot find or parse config.json", e) sys.exit(1)