Added better handling of ImportError.

This commit is contained in:
Jeremy Fincher 2003-04-14 05:44:19 +00:00
parent c6e47e6e12
commit aa4778254e
1 changed files with 6 additions and 1 deletions

View File

@ -108,7 +108,12 @@ if __name__ == '__main__':
while yn('Would you like to add a plugin?') == 'y':
plugin = expect('What plugin?', plugins)
moduleInfo = imp.find_module(plugin)
module = imp.load_module(plugin, *moduleInfo)
try:
module = imp.load_module(plugin, *moduleInfo)
except ImportError, e:
print 'Sorry, this plugin cannot be loaded. You need the ' \
'python module %s to load it.' % e.args[0].split()[-1]
continue
print module.__doc__
if yn('Would you like to add this plugin?') == 'y':
if hasattr(module, 'configure'):