mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
Added better handling of ImportError.
This commit is contained in:
parent
c6e47e6e12
commit
aa4778254e
@ -108,7 +108,12 @@ if __name__ == '__main__':
|
|||||||
while yn('Would you like to add a plugin?') == 'y':
|
while yn('Would you like to add a plugin?') == 'y':
|
||||||
plugin = expect('What plugin?', plugins)
|
plugin = expect('What plugin?', plugins)
|
||||||
moduleInfo = imp.find_module(plugin)
|
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__
|
print module.__doc__
|
||||||
if yn('Would you like to add this plugin?') == 'y':
|
if yn('Would you like to add this plugin?') == 'y':
|
||||||
if hasattr(module, 'configure'):
|
if hasattr(module, 'configure'):
|
||||||
|
Loading…
Reference in New Issue
Block a user