From a3520101c6d6450fb913ae24178f52ffacbb25a8 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Thu, 16 May 2024 22:01:42 -0400 Subject: [PATCH] BUG: imjoy_jupyterlab_extension argument to import_module Also remove duplicate try: except. Suggested-by: @KumoLiu --- itkwidgets/integrations/environment.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/itkwidgets/integrations/environment.py b/itkwidgets/integrations/environment.py index a951329..99e620f 100644 --- a/itkwidgets/integrations/environment.py +++ b/itkwidgets/integrations/environment.py @@ -52,15 +52,12 @@ def find_env(): # jupyterlab may not be available pass try: - import_module("imjoy-jupyterlab-extension") + import_module("imjoy_jupyterlab_extension") except ModuleNotFoundError: - try: - import_module("imjoy_jupyterlab_extension") - except ModuleNotFoundError: - if ENVIRONMENT is Env.JUPYTERLITE: - raise RuntimeError('imjoy-jupyterlab-extension is required. Install the package and refresh page.') - elif sys.version_info.minor > 7: - raise RuntimeError('imjoy-jupyterlab-extension is required. `pip install itkwidgets[lab]` and refresh page.') + if ENVIRONMENT is Env.JUPYTERLITE: + raise RuntimeError('imjoy-jupyterlab-extension is required. Install the package and refresh page.') + elif sys.version_info.minor > 7: + raise RuntimeError('imjoy-jupyterlab-extension is required. `pip install itkwidgets[lab]` and refresh page.') try: import imjoy_elfinder