Jon Dufresne wrote in
news:[email protected] in
gmane.comp.python.general:
> try:
> import extension_magic_module
> except ImportError:
> pass
> else:
> handle_extension_magic_module()
>
>
> However, if the the extension module exists but throws an ImportError,
> due to a bug in the extension this idiom will mask the error and I
> will never see it.
import imp
try:
m = imp.find_module( "test_1" )
if m[0]:
m[0].close()
except ImportError:
pass
else:
import test_1
http://docs.python.org/library/imp.html#imp.find_module
Rob.
--
http://mail.python.org/mailman/listinfo/python-list