Beispiel #1
0
	def addplugin(self, name, tasc):
		"""try to import module name and init it"""
		if name in self.plugins:
			Log.bad("Plugin %s is already loaded" % name)
			return
		try:
			code = __import__(name)
		except ImportError:
			Log.debug('trying to load plugin %s from plugins subdir' % name )
			try:
				pname = 'tasbot.plugins.%s' % name
				__import__(pname)
				code = sys.modules[pname]
			except ImportError, imp:
				Log.error("Cannot load plugin %s" % name)
				Log.exception(imp)
				raise SystemExit(1)