Assert config file exists.

This commit is contained in:
Edward Betts 2023-10-03 08:19:34 +01:00
parent a17f97e953
commit c6861c7d51

View file

@ -37,8 +37,12 @@ now_utc = datetime.now(timezone.utc)
next_us_presidential_election = date(2024, 11, 5)
next_uk_general_election = date(2024, 5, 2)
config_filename = os.path.join(os.path.dirname(__file__), "..", "config")
assert os.path.exists(config_filename)
config = configparser.ConfigParser()
config.read(os.path.join(os.path.dirname(__file__), "..", "config"))
config.read(config_filename)
access_key = config.get("exchangerate", "access_key")
data_dir = config.get("data", "dir")