From 556789524a1c03214d548cb1670042e5bb7d3024 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 24 Mar 2012 23:31:49 -0400 Subject: [PATCH] Fix importing dynamic module from config --- earwigbot/irc/watcher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/earwigbot/irc/watcher.py b/earwigbot/irc/watcher.py index 8d9cb4c..bfe1b8a 100644 --- a/earwigbot/irc/watcher.py +++ b/earwigbot/irc/watcher.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import imp import logging from earwigbot.irc import IRCConnection, RC, BrokenSocketException @@ -86,8 +87,9 @@ class Watcher(IRCConnection): rules = config.data["rules"] except KeyError: return + module = imp.new_module("_rc_event_rules") try: - module = compile(rules, config.config_path, "exec") + exec compile(rules, config.config_path, "exec") in module.__dict__ except Exception: e = "Could not compile config file's RC event rules" self.logger.exception(e)