From 254060fb393c31b8c2c9d93f103111479bafac7f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Thu, 9 Aug 2012 22:41:22 -0400 Subject: [PATCH] Import rules properly. --- earwigbot/irc/watcher.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/earwigbot/irc/watcher.py b/earwigbot/irc/watcher.py index 79f9f08..d7f5ff8 100644 --- a/earwigbot/irc/watcher.py +++ b/earwigbot/irc/watcher.py @@ -88,8 +88,11 @@ class Watcher(IRCConnection): # Set a default RC process hook that does nothing: self._process_hook = lambda bot, rc: () - path = os.path.join(self.bot.config.root_dir, "rules.py") - f, path, desc = imp.find_module("rules", [path]) + path = self.bot.config.root_dir + try: + f, path, desc = imp.find_module("rules", [path]) + except ImportError: + return try: module = imp.load_module(name, f, path, desc) except Exception: