diff --git a/bip/utils/config.py b/bip/utils/config.py index 3c0d1c24ffe9f3e5904e0f43f60a7c47fb795519..317b8463387dba88b92cb4fdbc2feff7fba8cb7f 100644 --- a/bip/utils/config.py +++ b/bip/utils/config.py @@ -67,6 +67,8 @@ def nested_lookup(d, key): if key[0] not in d: raise KeyError() + if not isinstance(d, dict): + return d d = d[key[0]] @@ -253,7 +255,15 @@ class Config: val = nested_lookup(settings, pat) except KeyError: continue + + # If an entry with a selector name as key is + # present, and is not a dictionary (e.g. + # "subject = 1"), this is probably an error + # in the config file, or the selectors the + # user has provided. Warn and carry on if not isinstance(val, dict): + log.warning('Ignoring primitive selector value (%s = %s)', + pat, val) continue log.debug('Updating settings from selector: %s', pat)