浏览代码

Fix importing dynamic module from config

tags/v0.1^2
Ben Kurtovic 12 年前
父节点
当前提交
556789524a
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      earwigbot/irc/watcher.py

+ 3
- 1
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)


正在加载...
取消
保存