From c6861c7d514b647ab0465c59f42c3bb45c75ca92 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Tue, 3 Oct 2023 08:19:34 +0100 Subject: [PATCH] Assert config file exists. --- agenda/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agenda/__init__.py b/agenda/__init__.py index 8e68ae5..e12de12 100644 --- a/agenda/__init__.py +++ b/agenda/__init__.py @@ -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")