3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

pylink: don't crash if plugin is missing

This commit is contained in:
James Lu 2016-01-03 21:05:45 -08:00
parent b0a405c6e0
commit 71e6319b70

7
pylink
View File

@ -29,11 +29,8 @@ if __name__ == '__main__':
for plugin in to_load:
try:
world.plugins[plugin] = pl = utils.loadModuleFromFolder(plugin, world.plugins_folder)
except ImportError as e:
if str(e) == ('No module named %r' % plugin):
log.error('Failed to load plugin %r: The plugin could not be found.', plugin)
else:
log.error('Failed to load plugin %r: ImportError: %s', plugin, str(e))
except (OSError, ImportError) as e:
log.exception('Failed to load plugin %r: %s: %s', plugin, type(e).__name__, str(e))
else:
if hasattr(pl, 'main'):
log.debug('Calling main() function of plugin %r', pl)