From baae47024cc92386fc7efcd2f1ab435d11e5d45e Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Tue, 8 Apr 2014 11:42:57 +0200 Subject: [PATCH] provide clear error message when trying to import from the source distribution --- kwant/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kwant/__init__.py b/kwant/__init__.py index 68157b4..b06661c 100644 --- a/kwant/__init__.py +++ b/kwant/__init__.py @@ -8,6 +8,14 @@ import numpy # Needed by C. Gohlke's Windows package. +try: + from . import _system +except ImportError: + msg = """Error importing Kwant: You should not try to import Kwant from + its source directory. Please exit the Kwant source tree, and relaunch + your Python intepreter from there.""" + raise ImportError(msg) + __all__ = ['system', 'version', 'builder', 'lattice', 'solvers', 'digest', 'rmt'] for module in __all__: -- GitLab