Steven D'Aprano wrote:
imp.find_module is deprecated and should not be used in new code.
...
try: block except (ImportError, RuntimeError): block
Thanks Steven and others who replied. Looks more elegant.
By the way, RuntimeError is almost never something you want to catch (except to log before bailing out). It should represent a fatal coding error, not something safe to ignore.
I was simply playing around with 'imp'. Hence I blocked RuntimeError. -- https://mail.python.org/mailman/listinfo/python-list