当前位置: 首页>>代码示例>>Python>>正文


Python log.error函数代码示例

本文整理汇总了Python中pychess.System.Log.log.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

 def save(self, *args):
     try:
         with open(self.jsonpath, "w") as f:
             json.dump(self._engines, f, indent=1, sort_keys=True)
     except IOError as e:
         log.error("Saving engines.json raised exception: %s" % \
                   ", ".join(str(a) for a in e.args))
开发者ID:fowode,项目名称:pychess,代码行数:7,代码来源:engineNest.py

示例2: set

def set (key, value):
    try:
        configParser.set (section, key, str(value))
        configParser.set (section+"_Types", key, typeEncode[type(value)])
    except Exception, e:
        log.error("Unable to save configuration '%s'='%s' because of error: %s %s"%
                (repr(key), repr(value), e.__class__.__name__, ", ".join(str(a) for a in e.args)))
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:7,代码来源:conf_configParser.py

示例3: load_from_xml

 def load_from_xml(self):
     if os.path.isfile(self.dockLocation):
         try:
             self.dock.loadFromXML(self.dockLocation, self.docks)
         except Exception as e:
             # We don't send error message when error caused by no more existing SwitcherPanel
             if e.args[0] != "SwitcherPanel" and "unittest" not in sys.modules.keys():
                 stringio = StringIO()
                 traceback.print_exc(file=stringio)
                 error = stringio.getvalue()
                 log.error("Dock loading error: %s\n%s" % (e, error))
                 msg_dia = Gtk.MessageDialog(mainwindow(),
                                             type=Gtk.MessageType.ERROR,
                                             buttons=Gtk.ButtonsType.CLOSE)
                 msg_dia.set_markup(_(
                     "<b><big>PyChess was unable to load your panel settings</big></b>"))
                 msg_dia.format_secondary_text(_(
                     "Your panel settings have been reset. If this problem repeats, \
                     you should report it to the developers"))
                 msg_dia.run()
                 msg_dia.hide()
             os.remove(self.dockLocation)
             for title, panel, menu_item in self.docks.values():
                 title.unparent()
                 panel.unparent()
开发者ID:teacoffee2017,项目名称:pychess,代码行数:25,代码来源:__init__.py

示例4: cb

 def cb(self_, *args):
     try:
         with open(self.xmlpath, "w") as f:
             self.dom.write(f)
     except IOError, e:
         log.error("Saving enginexml raised exception: %s\n" % \
                   ", ".join(str(a) for a in e.args))
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:7,代码来源:engineNest.py

示例5: _get_waitingplayer

 def _get_waitingplayer(self):
     try:
         return self.players[1 - self.getBoardAtPly(self.ply).color]
     except IndexError:
         log.error("%s %s" %
                   (self.players, 1 - self.getBoardAtPly(self.ply).color))
         raise
开发者ID:ME7ROPOLIS,项目名称:pychess,代码行数:7,代码来源:GameModel.py

示例6: getBoardAtPly

 def getBoardAtPly(self, ply, variation=0):
     try:
         return self.variations[variation][self._plyToIndex(ply)]
     except IndexError:
         log.error("%d\t%d\t%d\t%d\t%d" % (self.lowply, ply, self.ply,
                                           variation, len(self.variations)))
         raise
开发者ID:leogregianin,项目名称:pychess,代码行数:7,代码来源:GameModel.py

示例7: page_reordered

 def page_reordered (widget, child, new_num, headbook):
     old_num = notebooks["board"].page_num(key2gmwidg[child].boardvbox)
     if old_num == -1:
         log.error('Games and labels are out of sync!')
     else:
         for notebook in notebooks.values():
             notebook.reorder_child(notebook.get_nth_page(old_num), new_num)
开发者ID:sally0813,项目名称:pychess,代码行数:7,代码来源:gamewidget.py

示例8: getMoveAtPly

 def getMoveAtPly(self, ply, variation=0):
     try:
         return Move(self.variations[variation][self._plyToIndex(ply) +
                                                1].board.lastMove)
     except IndexError:
         log.error("%d\t%d\t%d\t%d\t%d" % (self.lowply, ply, self.ply,
                                           variation, len(self.variations)))
         raise
开发者ID:ME7ROPOLIS,项目名称:pychess,代码行数:8,代码来源:GameModel.py

示例9: getBoardAtPly

 def getBoardAtPly (self, ply, variation=0):
     # Losing on time in FICS game will undo our last move if it was taken too late
     if variation == 0 and ply > self.ply:
         ply = self.ply
     try:
         return self.variations[variation][self._plyToIndex(ply)]
     except IndexError:
         log.error("%d\t%d\t%d\t%d\t%d" % (self.lowply, ply, self.ply, variation, len(self.variations)))
         raise
开发者ID:vgupta2507,项目名称:pychess,代码行数:9,代码来源:GameModel.py

示例10: set

def set (key, value):
    try:
        configParser.set (section, key, str(value))
    except Exception as e:
        log.error("Unable to save configuration '%s'='%s' because of error: %s %s"%
                (repr(key), repr(value), e.__class__.__name__, ", ".join(str(a) for a in e.args)))
    for key_, func, args in idkeyfuncs.values():
        if key_ == key:
            func (None, *args)
开发者ID:fowode,项目名称:pychess,代码行数:9,代码来源:conf_configParser.py

示例11: set

def set(key, value, section=section):
    try:
        configParser.set(section, key, str(value))
        configParser.write(open(path, "w"))
    except Exception as err:
        log.error(
            "Unable to save configuration '%s'='%s' because of error: %s %s" %
            (repr(key), repr(value), err.__class__.__name__, ", ".join(
                str(a) for a in err.args)))
    for key_, func, args, section_ in idkeyfuncs.values():
        if key_ == key and section_ == section:
            func(None, *args)
开发者ID:bboutkov,项目名称:pychess,代码行数:12,代码来源:conf.py

示例12: savePosition

 def savePosition (window, *event):
     
     width = window.get_allocation().width
     height = window.get_allocation().height
     x, y = window.get_position()
     
     if width <= 0:
         log.error("Setting width = '%d' for %s to conf" % (width,key))
     if height <= 0:
         log.error("Setting height = '%d' for %s to conf" % (height,key))
     
     conf.set(key+"_width",  width)
     conf.set(key+"_height", height)
     conf.set(key+"_x", x)
     conf.set(key+"_y", y)
开发者ID:btrent,项目名称:knave,代码行数:15,代码来源:uistuff.py

示例13: run

 def run (self):
     # Avoid racecondition when self.start is called while we are in self.end
     if self.status != WAITING_TO_START:
         return
     self.status = RUNNING
     
     for player in self.players + self.spectactors.values():
         player.start()
     
     self.emit("game_started")
     
     while self.status in (PAUSED, RUNNING, DRAW, WHITEWON, BLACKWON):
         curColor = self.boards[-1].color
         curPlayer = self.players[curColor]
         
         if self.timemodel:
             log.debug("GameModel.run: id=%s, players=%s, self.ply=%s: updating %s's time\n" % \
                 (id(self), str(self.players), str(self.ply), str(curPlayer)))
             curPlayer.updateTime(self.timemodel.getPlayerTime(curColor),
                                  self.timemodel.getPlayerTime(1-curColor))
         
         try:
             log.debug("GameModel.run: id=%s, players=%s, self.ply=%s: calling %s.makeMove()\n" % \
                 (id(self), str(self.players), self.ply, str(curPlayer)))
             if self.ply > self.lowply:
                 move = curPlayer.makeMove(self.boards[-1],
                                           self.moves[-1],
                                           self.boards[-2])
             else: move = curPlayer.makeMove(self.boards[-1], None, None)
             log.debug("GameModel.run: id=%s, players=%s, self.ply=%s: got move=%s from %s\n" % \
                 (id(self), str(self.players), self.ply, move, str(curPlayer)))
         except PlayerIsDead, e:
             if self.status in (WAITING_TO_START, PAUSED, RUNNING):
                 stringio = cStringIO.StringIO()
                 traceback.print_exc(file=stringio)
                 error = stringio.getvalue()
                 log.error("GameModel.run: A Player died: player=%s error=%s\n%s" % (curPlayer, error, e))
                 if curColor == WHITE:
                     self.kill(WHITE_ENGINE_DIED)
                 else: self.kill(BLACK_ENGINE_DIED)
             break
         except TurnInterrupt:
             log.debug("GameModel.run: id=%s, players=%s, self.ply=%s: TurnInterrupt\n" % \
                 (id(self), str(self.players), self.ply))
             continue
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:45,代码来源:GameModel.py

示例14: savePosition

    def savePosition(window, *event):
        log.debug("keepWindowSize.savePosition: %s" % window.get_title())
        width = window.get_allocation().width
        height = window.get_allocation().height
        x_loc, y_loc = window.get_position()

        if width <= 0:
            log.error("Setting width = '%d' for %s to conf" % (width, key))
        if height <= 0:
            log.error("Setting height = '%d' for %s to conf" % (height, key))

        log.debug("Saving window position width=%s height=%s x=%s y=%s" %
                  (width, height, x_loc, y_loc))
        conf.set(key + "_width", width)
        conf.set(key + "_height", height)
        conf.set(key + "_x", x_loc)
        conf.set(key + "_y", y_loc)

        return False
开发者ID:teacoffee2017,项目名称:pychess,代码行数:19,代码来源:uistuff.py

示例15: onOfferAdd

 def onOfferAdd (self, match):
     log.debug("OfferManager.onOfferAdd: match.string=%s\n" % match.string)
     tofrom, index, offertype, parameters = match.groups()
     if tofrom == "t":
         # ICGameModel keeps track of the offers we've sent ourselves, so we
         # don't need this
         return
     if offertype not in strToOfferType:
         log.error("OfferManager.onOfferAdd: Declining unknown offer type: " + \
             "offertype=%s parameters=%s index=%s\n" % (offertype, parameters, index))
         print >> self.connection.client, "decline", index
     offertype = strToOfferType[offertype]
     if offertype == TAKEBACK_OFFER:
         offer = Offer(offertype, param=int(parameters), index=int(index))
     else:
         offer = Offer(offertype, index=int(index))
     self.offers[offer.index] = offer
     
     if offer.type == MATCH_OFFER:
         if matchreUntimed.match(parameters) != None:
             fname, frating, col, tname, trating, rated, type = \
                 matchreUntimed.match(parameters).groups()
             mins = "0"
             incr = "0"
         else:
             fname, frating, col, tname, trating, rated, type_short, mins, incr, type = \
                 matchre.match(parameters).groups()
             if not type or "adjourned" in type:
                 type = type_short
         
         if type.split()[-1] in unsupportedtypes:
             self.decline(offer)
         else:
             rating = frating.strip()
             rating = rating.isdigit() and rating or "0"
             rated = rated == "unrated" and "u" or "r"
             match = {"tp": convertName(type), "w": fname, "rt": rating,
                      "r": rated, "t": mins, "i": incr}
             self.emit("onChallengeAdd", index, match)
     
     else:
         log.debug("OfferManager.onOfferAdd: emitting onOfferAdd: %s\n" % offer)
         self.emit("onOfferAdd", offer)
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:43,代码来源:OfferManager.py


注:本文中的pychess.System.Log.log.error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。