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
Branches
Tags
No related merge requests found
......@@ -13,10 +13,15 @@ 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 distribution directory,
and relaunch your Python intepreter from there."""
raise ImportError(msg)
import inspect
if len(inspect.trace()) == 1:
msg = """Error importing Kwant:
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
__all__.append('KwantDeprecationWarning')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment