Polishing.

This commit is contained in:
Felix Fontein 2025-02-02 17:35:18 +01:00
parent f39977573b
commit 423ad11d50

View File

@ -119,16 +119,17 @@ class ContextAPI(object):
If the server returns an error. If the server returns an error.
""" """
names = [] names = []
for dirname, dirnames, fnames in os.walk(get_meta_dir()): for dirname, dummy, fnames in os.walk(get_meta_dir()):
for filename in fnames + dirnames: for filename in fnames:
if filename == METAFILE: if filename == METAFILE:
filepath = os.path.join(dirname, filename)
try: try:
data = json.load( with open(filepath, "r") as f:
open(os.path.join(dirname, filename))) data = json.load(f)
names.append(data["Name"]) names.append(data["Name"])
except Exception as e: except Exception as e:
raise errors.ContextException( raise errors.ContextException(
f"Failed to load metafile {filename}: {e}", f"Failed to load metafile {filepath}: {e}",
) from e ) from e
contexts = [cls.DEFAULT_CONTEXT] contexts = [cls.DEFAULT_CONTEXT]