From 00bb47fb244a610a8e600cee04f18e8fbe9b0c56 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 20 Jul 2015 10:22:32 -0700 Subject: [PATCH] Error on disabling extension not currently enabled --- notebook/nbextensions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/notebook/nbextensions.py b/notebook/nbextensions.py index 92b42c179..a9ea2c5e2 100644 --- a/notebook/nbextensions.py +++ b/notebook/nbextensions.py @@ -371,6 +371,8 @@ class DisableNBExtensionApp(JupyterApp): # Local import to avoid circular import issue on Py 2 from notebook.services.config import ConfigManager cm = ConfigManager(parent=self, config=self.config) + if name not in cm.get(self.section).get('load_extensions', {}): + sys.exit('{} is not enabled in section {}'.format(name, self.section)) # We're using a dict as a set - updating with None removes the key cm.update(self.section, {"load_extensions": {name: None}})