From 19c753e9ed7fbd84bf234b0a87596fb90f0b557f Mon Sep 17 00:00:00 2001 From: bendichter Date: Thu, 10 Nov 2022 11:21:02 -0500 Subject: [PATCH 1/7] better error message for common git clone error --- src/pynwb/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 6cf7d7656..b0dff3b7c 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -126,6 +126,12 @@ def register_class(**kwargs): neurodata_type, namespace, container_cls = getargs('neurodata_type', 'namespace', 'container_cls', kwargs) def _dec(cls): + if "core" not in __TYPE_MAP.namespace_catalog.namespaces: + raise KeyError( + "'core' not a registered namespace. If you installed PyNWB locally using a git clone, you need to use " + "the --recurse_submodules flag when closing. See developer installation instructions here: " + "https://pynwb.readthedocs.io/en/stable/install_developers.html#install-from-git-repository" + ) __TYPE_MAP.register_container_type(namespace, neurodata_type, cls) return cls if container_cls is None: From e493b996fd33ec417dafba49ff48d594a1be7b94 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Thu, 10 Nov 2022 11:23:08 -0500 Subject: [PATCH 2/7] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5172c40d8..637992331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ [#1583](https://github.com/NeurodataWithoutBorders/pynwb/pull/1583) - Update round trip tutorial to the newer ``NWBH5IOMixin`` and ``AcquisitionH5IOMixin`` classes. @bendichter [#1586](https://github.com/NeurodataWithoutBorders/pynwb/pull/1586) +- More informative error for common installation error [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) ## PyNWB 2.2.0 (October 19, 2022) From 988f9fe65d48da1a40a23a194e60f199d5b5586c Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Thu, 10 Nov 2022 11:23:22 -0500 Subject: [PATCH 3/7] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 637992331..abb8915af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ [#1583](https://github.com/NeurodataWithoutBorders/pynwb/pull/1583) - Update round trip tutorial to the newer ``NWBH5IOMixin`` and ``AcquisitionH5IOMixin`` classes. @bendichter [#1586](https://github.com/NeurodataWithoutBorders/pynwb/pull/1586) -- More informative error for common installation error [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) +- More informative error message for common installation error [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) ## PyNWB 2.2.0 (October 19, 2022) From ea9373a98fc8337c7dd613c1b582842a49e010ed Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Thu, 10 Nov 2022 09:49:42 -0800 Subject: [PATCH 4/7] Update __init__.py --- src/pynwb/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index b0dff3b7c..07c5e8b0e 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -128,8 +128,8 @@ def register_class(**kwargs): def _dec(cls): if "core" not in __TYPE_MAP.namespace_catalog.namespaces: raise KeyError( - "'core' not a registered namespace. If you installed PyNWB locally using a git clone, you need to use " - "the --recurse_submodules flag when closing. See developer installation instructions here: " + "'core' is not a registered namespace. If you installed PyNWB locally using a git clone, you need to " + "use the --recurse_submodules flag when cloning. See developer installation instructions here: " "https://pynwb.readthedocs.io/en/stable/install_developers.html#install-from-git-repository" ) __TYPE_MAP.register_container_type(namespace, neurodata_type, cls) From 9efe4d44b261bf2e979ec2343d2b9d58ee77ac13 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Thu, 10 Nov 2022 09:50:10 -0800 Subject: [PATCH 5/7] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abb8915af..9f698929a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ [#1583](https://github.com/NeurodataWithoutBorders/pynwb/pull/1583) - Update round trip tutorial to the newer ``NWBH5IOMixin`` and ``AcquisitionH5IOMixin`` classes. @bendichter [#1586](https://github.com/NeurodataWithoutBorders/pynwb/pull/1586) -- More informative error message for common installation error [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) +- More informative error message for common installation error. @bendichter + [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) ## PyNWB 2.2.0 (October 19, 2022) From e14694a9455af3814007d375ce762d234cd981e0 Mon Sep 17 00:00:00 2001 From: rly Date: Thu, 10 Nov 2022 09:58:20 -0800 Subject: [PATCH 6/7] Move error check --- src/pynwb/__init__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pynwb/__init__.py b/src/pynwb/__init__.py index 07c5e8b0e..d1f5cd0bc 100644 --- a/src/pynwb/__init__.py +++ b/src/pynwb/__init__.py @@ -101,10 +101,16 @@ def load_namespaces(**kwargs): return __TYPE_MAP.load_namespaces(namespace_path) -# load the core namespace i.e. base NWB specification +# load the core namespace, i.e. base NWB specification __resources = __get_resources() if os.path.exists(__resources['namespace_path']): load_namespaces(__resources['namespace_path']) +else: + raise RuntimeError( + "'core' is not a registered namespace. If you installed PyNWB locally using a git clone, you need to " + "use the --recurse_submodules flag when cloning. See developer installation instructions here: " + "https://pynwb.readthedocs.io/en/stable/install_developers.html#install-from-git-repository" + ) def available_namespaces(): @@ -126,12 +132,6 @@ def register_class(**kwargs): neurodata_type, namespace, container_cls = getargs('neurodata_type', 'namespace', 'container_cls', kwargs) def _dec(cls): - if "core" not in __TYPE_MAP.namespace_catalog.namespaces: - raise KeyError( - "'core' is not a registered namespace. If you installed PyNWB locally using a git clone, you need to " - "use the --recurse_submodules flag when cloning. See developer installation instructions here: " - "https://pynwb.readthedocs.io/en/stable/install_developers.html#install-from-git-repository" - ) __TYPE_MAP.register_container_type(namespace, neurodata_type, cls) return cls if container_cls is None: From e4159a9b08b72817b8ca2ac6bccaf2f388545964 Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Thu, 10 Nov 2022 10:00:47 -0800 Subject: [PATCH 7/7] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f698929a..476bdce98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ [#1583](https://github.com/NeurodataWithoutBorders/pynwb/pull/1583) - Update round trip tutorial to the newer ``NWBH5IOMixin`` and ``AcquisitionH5IOMixin`` classes. @bendichter [#1586](https://github.com/NeurodataWithoutBorders/pynwb/pull/1586) -- More informative error message for common installation error. @bendichter +- More informative error message for common installation error. @bendichter, @rly [#1591](https://github.com/NeurodataWithoutBorders/pynwb/pull/1591) ## PyNWB 2.2.0 (October 19, 2022)