From a8ff6f9c6d9e5b0c5e1faa9f2e6d48a4ef706379 Mon Sep 17 00:00:00 2001 From: Olivier Delalleau <507137+odelalleau@users.noreply.github.com> Date: Sun, 29 Nov 2020 10:16:57 -0500 Subject: [PATCH] More readable error message formatting --- omegaconf/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/omegaconf/base.py b/omegaconf/base.py index 9dcb7a934..8dc541a1b 100644 --- a/omegaconf/base.py +++ b/omegaconf/base.py @@ -292,9 +292,11 @@ def _select_impl( ) if ret is not None and not isinstance(ret, Container): + parent_key = ".".join(split[0 : i + 1]) + child_key = split[i + 1] raise ConfigKeyError( - f"Error trying to access {key}: node `{'.'.join(split[0:i + 1])}` " - f"is not a container and thus cannot contain `{split[i + 1]}``" + f"Error trying to access {key}: node `{parent_key}` " + f"is not a container and thus cannot contain `{child_key}`" ) root = ret