mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 11:42:51 +01:00
pylink: don't crash if plugin is missing
This commit is contained in:
parent
b0a405c6e0
commit
71e6319b70
7
pylink
7
pylink
@ -29,11 +29,8 @@ if __name__ == '__main__':
|
|||||||
for plugin in to_load:
|
for plugin in to_load:
|
||||||
try:
|
try:
|
||||||
world.plugins[plugin] = pl = utils.loadModuleFromFolder(plugin, world.plugins_folder)
|
world.plugins[plugin] = pl = utils.loadModuleFromFolder(plugin, world.plugins_folder)
|
||||||
except ImportError as e:
|
except (OSError, ImportError) as e:
|
||||||
if str(e) == ('No module named %r' % plugin):
|
log.exception('Failed to load plugin %r: %s: %s', plugin, type(e).__name__, str(e))
|
||||||
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))
|
|
||||||
else:
|
else:
|
||||||
if hasattr(pl, 'main'):
|
if hasattr(pl, 'main'):
|
||||||
log.debug('Calling main() function of plugin %r', pl)
|
log.debug('Calling main() function of plugin %r', pl)
|
||||||
|
Loading…
Reference in New Issue
Block a user