ircbot: handle more plugin load failures

possibly handle them a bit more cleanly, too, by deleting sys.modules
entries
This commit is contained in:
Brian S. Stephan 2015-05-15 17:01:25 -05:00
parent e7839606ec
commit bf68099f2f
1 changed files with 7 additions and 0 deletions

View File

@ -412,6 +412,13 @@ class IRCBot(irc.client.SimpleIRCClient):
except ImportError as e:
log.error("Error loading '{0:s}'".format(plugin_path))
log.exception(e)
del sys.modules[plugin_path]
if feedback:
self.privmsg(dest, "Plugin '{0:s}' could not be loaded: {1:s}".format(plugin_path, e))
except AttributeError as e:
log.error("Error loading '{0:s}'".format(plugin_path))
log.exception(e)
del sys.modules[plugin_path]
if feedback:
self.privmsg(dest, "Plugin '{0:s}' could not be loaded: {1:s}".format(plugin_path, e))