Skip to content
Snippets Groups Projects
Commit ef2b2f0a authored by Christoph Groth's avatar Christoph Groth
Browse files

fix confusing error message if there was an ImportError inside kwant._system

parent 828fe368
No related branches found
No related tags found
No related merge requests found
...@@ -13,10 +13,15 @@ import numpy # Needed by C. Gohlke's Windows package. ...@@ -13,10 +13,15 @@ import numpy # Needed by C. Gohlke's Windows package.
try: try:
from . import _system from . import _system
except ImportError: except ImportError:
msg = """Error importing Kwant: You should not try to import Kwant from import inspect
its source directory. Please exit the Kwant source distribution directory, if len(inspect.trace()) == 1:
and relaunch your Python intepreter from there.""" msg = """Error importing Kwant:
raise ImportError(msg) You should not try to import Kwant from its source directory.
Please exit the Kwant source distribution directory, and relaunch
your Python intepreter from there."""
raise ImportError(msg)
else:
raise
from ._common import KwantDeprecationWarning from ._common import KwantDeprecationWarning
__all__.append('KwantDeprecationWarning') __all__.append('KwantDeprecationWarning')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment