From 7330bd491ab2d754d004d71736b20cd8e3d08ee0 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Fri, 3 Jun 2016 01:36:28 -0400 Subject: [PATCH] Fix widget warning in case of ipywidgets 5.x --- notebook/notebookapp.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 20f2a2089..e709bac0b 100644 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -236,15 +236,18 @@ class NotebookWebApplication(web.Application): # BEGIN HARDCODED WIDGETS HACK # TODO: Remove on notebook 5.0 try: - import ipywidgets as widgets - handlers.append( - (r"/nbextensions/widgets/(.*)", FileFindHandler, { - 'path': widgets.find_static_assets(), - 'no_cache_paths': ['/'], # don't cache anything in nbextensions - }), - ) + import widgetsnbextension except: - app_log.warning('Widgets are unavailable. Please install widgetsnbextension or ipywidgets 4.0') + try: + import ipywidgets as widgets + handlers.append( + (r"/nbextensions/widgets/(.*)", FileFindHandler, { + 'path': widgets.find_static_assets(), + 'no_cache_paths': ['/'], # don't cache anything in nbextensions + }), + ) + except: + app_log.warning('Widgets are unavailable. Please install widgetsnbextension or ipywidgets 4.0') # END HARDCODED WIDGETS HACK handlers.append(