From d0f7962d8ab83d76d256a59ab593e2130a029db1 Mon Sep 17 00:00:00 2001 From: Joanne Bogart Date: Wed, 15 May 2024 23:54:03 -0700 Subject: [PATCH] bug fix for Config.get_config_value --- skycatalogs/utils/config_utils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/skycatalogs/utils/config_utils.py b/skycatalogs/utils/config_utils.py index 00450b89..23a01228 100644 --- a/skycatalogs/utils/config_utils.py +++ b/skycatalogs/utils/config_utils.py @@ -150,7 +150,13 @@ def get_config_value(self, key_path, silent=False): d = d[i] if not isinstance(d, dict): raise ValueError(f'intermediate {d} is not a dict') - return d[path_items[-1]] + + if path_items[-1] in d: + return d[path_items[-1]] + else: + if silent: + return None + raise ValueError(f'Item {i} not found') def add_key(self, k, v): '''