Преглед на файлове

Add more helpful import error.

Jason Grout преди 8 години
родител
ревизия
b9f214ad85
променени са 1 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 7 1
      jupyterlab/__init__.py

+ 7 - 1
jupyterlab/__init__.py

@@ -10,7 +10,13 @@ from tornado import web
 from notebook.base.handlers import IPythonHandler, FileFindHandler
 from jinja2 import FileSystemLoader
 from notebook.utils import url_path_join as ujoin
-from ._version import __version__
+
+
+try:
+    from ._version import __version__
+except ImportError as e:
+    # when we are python 3 only, add 'from e' at the end to chain the exception.
+    raise ImportError("No module named 'jupyter._version'. Build the jupyterlab package to generate this module, for example, with `pip install -e /path/to/jupyterlab/repo`.")
 
 #-----------------------------------------------------------------------------
 # Module globals