Bläddra i källkod

Add more helpful import error.

Jason Grout 8 år sedan
förälder
incheckning
b9f214ad85
1 ändrade filer med 7 tillägg och 1 borttagningar
  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