On May 21, 11:17 pm, dmitrey <[EMAIL PROTECTED]> wrote: > howto check does module 'asdf' exist (is available for import) or no? try : import asdf del asdf except ImportError : print "module asdf not available" else : print "module asdf available for loading"
You can generalise this, but at the expense of a couple of exec statements: def is_module_available (module) : try : exec('import %s' % module) exec('del %s' % module) except ImportError : return False else : return True > (without try/cache of course) Oops sorry, you wanted it done in some non-obvious way! Why?! -- http://mail.python.org/mailman/listinfo/python-list