From 414b0faf5050875b8d1381a7db9c2bb0d2698edd Mon Sep 17 00:00:00 2001 From: Igor Tatarnikov <61896994+IgorTatarnikov@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:58:44 +0700 Subject: [PATCH] Create brainglobe dir if none present during get_atlases_lastversions call (#402) --- brainglobe_atlasapi/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brainglobe_atlasapi/utils.py b/brainglobe_atlasapi/utils.py index e78482a0..2ef6d0dc 100644 --- a/brainglobe_atlasapi/utils.py +++ b/brainglobe_atlasapi/utils.py @@ -307,6 +307,9 @@ def conf_from_url(url) -> configparser.ConfigParser: config_obj.read_string(text) cache_path = config.get_brainglobe_dir() / "last_versions.conf" + if not cache_path.parent.exists(): + cache_path.parent.mkdir(parents=True, exist_ok=True) + # Cache the available atlases with open(cache_path, "w") as f_out: config_obj.write(f_out)