Skip to content

Commit 9528f4a

Browse files
author
Sergey Skripnick
committed
Show more verbose message on import errors
ImportError is not always 'module not found', so we should display more verbose message when this exception occured. For example message: aiohttp.web: error: unable to import defiler.server: No module named 'aiomysql' is more useful then: aiohttp.web: error: module 'defiler.server' not found
1 parent de17c89 commit 9528f4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aiohttp/web.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ def main(argv):
366366
arg_parser.error("relative module names not supported")
367367
try:
368368
module = import_module(mod_str)
369-
except ImportError:
370-
arg_parser.error("module %r not found" % mod_str)
369+
except ImportError as ex:
370+
arg_parser.error("unable to import %s: %s" % (mod_str, ex))
371371
try:
372372
func = getattr(module, func_str)
373373
except AttributeError:

0 commit comments

Comments
 (0)