[PEAK] plugins, dynamic module loading
darryl
developer at csrules.dyndns.org
Mon Nov 24 11:17:52 EST 2003
hey all,
I'm writing a whole series of stupid jabber/irc bots. Right now i'm
working on dynamically loading modules/plugins. Here's what i'm doing
now:
def loadModules(self, path):
for m in glob.glob("%s/*.py" % path):
m = re.sub(path, "", m)
m = re.sub(r'[/\\]', "", m)
m = re.sub("\.py$", "", m)
exec "import %s\nself.modules.append(%s.%s(self))\n" %(m,m,m)
print "registered %s" %m
It's very ugly :)
Is there a peak-ish way to do this sort of thing?
-cheers,
darryl
More information about the PEAK
mailing list