Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(123) | Call(123) | Derive(0) | Import(0)
Log an error message to the main log.
src/b/3/b3-plugin-chatlogger-HEAD/extplugins/chatlogger.py b3-plugin-chatlogger(Download)
self.info('Using file (%s) to store log', self._file_name) except Exception, e: self.error('error while reading logfile name. disabling logging to file. (%s)' % e) self._save2file = False return
except Exception, e: self._save2file = False self.error("cannot setup file chat logger. disabling logging to file (%s)" % e, exc_info=e) def loadConfig_database(self):
days = int(text) except ValueError, e: self.error("Could not convert '%s' to a valid number of days. (%s)" % (text, e)) days = 0 return days
src/b/3/b3-1.9.2/b3/plugins/adv.py b3(Download)
self.info('adv rate is %s' % self._rate) except: self.error('config missing [settings].rate') return False
def loadFromFile(self, fileName): if not os.path.isfile(fileName): self.error('Ad file %s does not exist', fileName) return False
ad = None else: self.error('XLRstats not installed! Cannot use @topstats in adv plugin!') ad = '@topstats not available, XLRstats is not installed!' elif ad == "@admins":
ad = None except Exception, err: self.error("could not send adv message @admins", exc_info=err) if firstTry: # try another ad
ad = None except Exception, err: self.error("could not send adv message @regulars", exc_info=err) if firstTry: # try another ad
src/b/i/big-brother-bot-HEAD/b3/plugins/adv.py big-brother-bot(Download)
self.info('adv rate is %s' % self._rate) except: self.error('config missing [settings].rate') return False
def loadFromFile(self, fileName): if not os.path.isfile(fileName): self.error('Ad file %s does not exist', fileName) return False
ad = None else: self.error('XLRstats not installed! Cannot use @topstats in adv plugin!') ad = '@topstats not available, XLRstats is not installed!' elif ad == "@admins":
ad = None except Exception, err: self.error("could not send adv message @admins", exc_info=err) if firstTry: # try another ad
ad = None except Exception, err: self.error("could not send adv message @regulars", exc_info=err) if firstTry: # try another ad
src/b/3/b3-1.9.2/b3/plugins/admin.py b3(Download)
if not self.console.storage.db: self.error('There is no database connection! Cannot store or retrieve any information. Fix the database connection first!') else: try:
def registerCommand(self, plugin, command, level, handler, alias=None, secretLevel=None): if not handler: self.error('Command "%s" registration failed, no handler' % command) return False
if clean_level is False: groups = self.console.storage.getGroups() self.error("Cannot register command '%s'. Bad level/group : '%s'. Expecting a level (%s) or group keyword (%s)" % (command, level, ', '.join([str(x.level) for x in groups]), ', '.join([x.keyword for x in groups]))) return
return True except Exception, msg: self.error('Command "%s" registration failed. %s' % (command, msg)) self.exception(msg) return False
levelmin = self.console.getGroupLevel(levelmin) except KeyError: self.error('unknown group %s' % levelmin) return False try:
src/b/i/big-brother-bot-HEAD/b3/plugins/admin.py big-brother-bot(Download)
if not self.console.storage.db: self.error('There is no database connection! Cannot store or retrieve any information. Fix the database connection first!') else: try:
def registerCommand(self, plugin, command, level, handler, alias=None, secretLevel=None): if not handler: self.error('Command "%s" registration failed, no handler' % command) return False
if clean_level is False: groups = self.console.storage.getGroups() self.error("Cannot register command '%s'. Bad level/group : '%s'. Expecting a level (%s) or group keyword (%s)" % (command, level, ', '.join([str(x.level) for x in groups]), ', '.join([x.keyword for x in groups]))) return
return True except Exception, msg: self.error('Command "%s" registration failed. %s' % (command, msg)) self.exception(msg) return False
levelmin = self.console.getGroupLevel(levelmin) except KeyError: self.error('unknown group %s' % levelmin) return False try:
src/b/3/b3-1.9.2/b3/plugins/status.py b3(Download)
self.console.storage.query(sql) except: self.error('Error: inserting svars. sqlqry=%s' % (sql)) # --- End Game section
self.console.storage.query(sql) except: self.error('Error: inserting clients. sqlqry=%s' % (sql)) b3clients.appendChild(client)
clean_data = sanitizeMe(v) except Exception, err: self.error("could not sanitize %r" % v, exc_into=err) data.setAttribute("Value", "") else:
except Exception, err: self.error('XML Failed: %r' % err, exc_info=err) pass
self.console.storage.query(sql) except: self.error('Error: inserting svars. sqlqry=%s' % (sql)) def writeXML(self, xml):
src/b/i/big-brother-bot-HEAD/b3/plugins/status.py big-brother-bot(Download)
self.console.storage.query(sql) except: self.error('Error: inserting svars. sqlqry=%s' % (sql)) # --- End Game section
self.console.storage.query(sql) except: self.error('Error: inserting clients. sqlqry=%s' % (sql)) b3clients.appendChild(client)
clean_data = sanitizeMe(v) except Exception, err: self.error("could not sanitize %r" % v, exc_into=err) data.setAttribute("Value", "") else:
except Exception, err: self.error('XML Failed: %r' % err, exc_info=err) pass
self.console.storage.query(sql) except: self.error('Error: inserting svars. sqlqry=%s' % (sql)) def writeXML(self, xml):
src/b/3/b3-1.9.2/b3/plugins/censor.py b3(Download)
def _getCensorData(self, name, regexp, penalty, defaultPenalty): try: regexp = re.compile(regexp, re.I) except re.error, e: self.error('Invalid regular expression: %s - %s' % (name, regexp))
raise except Exception, msg: self.error('Censor plugin error: %s - %s', msg, traceback.extract_tb(sys.exc_info()[2])) def penalizeClient(self, penalty, client, data=''):
src/b/i/big-brother-bot-HEAD/b3/plugins/censor.py big-brother-bot(Download)
def _getCensorData(self, name, regexp, penalty, defaultPenalty): try: regexp = re.compile(regexp, re.I) except re.error, e: self.error('Invalid regular expression: %s - %s' % (name, regexp))
raise except Exception, msg: self.error('Censor plugin error: %s - %s', msg, traceback.extract_tb(sys.exc_info()[2])) def penalizeClient(self, penalty, client, data=''):
src/b/3/b3-plugin-poweradminurt-HEAD/extplugins/poweradminurt/iourt41.py b3-plugin-poweradminurt(Download)
if not self._adminPlugin: # something is wrong, can't start without admin plugin self.error('Could not find admin plugin') return False
padic = False except ValueError, err: self.error("cannot read publicmode/usedic in config file, using default : no") self.debug(err) padic = False
cmd.sayLoudOrPM(client, result) else: self.error('%s is not a valid configfile', data) return True
if not self.countteams(): self._balancing = False self.error('Aborting teambalance. Counting teams failed!') return False if abs(self._teamred - self._teamblue) <= self._teamdiff:
if not self.countteams(): self._balancing = False self.error('Aborting teambalance. Counting teams failed!') return False
1 | 2 | 3 Next