Python Forum

Full Version: ImportError has not raised in pkg_resources module but expected
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried to use pkg_resources module in rbtools but I got exception as No module named _imp.

In python 2.7.15rc1 (/usr/lib/python2.7/dist-packages/pkg_resources), we handled if _imp module is not found then we are importing "imp as _imp" in except block.

try:
import _imp
except ImportError:
# Python 3.2 compatibility
import imp as _imp


Here the issue is, try block doesn't raise exception and not handled in except block to set it from imp module.

Please help to resolve this issue. Thanks in advance!

OS: Ubuntu 18.04
No module named _imp is not an exception, it is an error message. Please post the whole exception traceback.
No module named _imp
*** failed to import extension reviewboard from /home/mercurial-reviewboard-stage: name 'SyncTransport' is not defined

I'm expecting try block should raise if it is not found

But when I try it in console it is raising