• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python log.error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: save

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


示例17: parseGame


#.........这里部分代码省略.........
        minutes = int(minutes)
        increment = int(increment)
        game_type = GAME_TYPES[game_type]

        reason = matchlist[-1].group().lower()
        if in_progress:
            result = None
            result_str = "*"
        elif "1-0" in reason:
            result = WHITEWON
            result_str = "1-0"
        elif "0-1" in reason:
            result = BLACKWON
            result_str = "0-1"
        elif "1/2-1/2" in reason:
            result = DRAW
            result_str = "1/2-1/2"
        else:
            result = ADJOURNED
            result_str = "*"
        result, reason = parse_reason(result, reason, wname=wname)

        index += 3
        if matchlist[index].startswith("<12>"):
            style12 = matchlist[index][5:]
            castleSigns = self.generateCastleSigns(style12, game_type)
            gameno, relation, curcol, ply, wname, bname, wms, bms, gain, lastmove, \
                fen = self.parseStyle12(style12, castleSigns)
            initialfen = fen
            movesstart = index + 4
        else:
            if game_type.rating_type == TYPE_WILD:
                # we need a style12 start position to correctly parse a wild/* board
                log.error("BoardManager.parseGame: no style12 for %s board." % game_type.fics_name)
                return None
            castleSigns = ("k", "q")
            initialfen = None
            movesstart = index + 2
        
        if in_progress:
            self.castleSigns[gameno] = castleSigns
        
        moves = {}
        times = {}
        wms = bms = minutes * 60 * 1000
        for line in matchlist[movesstart:-1]:
            if not moveListMoves.match(line):
                log.error("BoardManager.parseGame: unmatched line: \"%s\"" % \
                          repr(line))
                raise Exception("BoardManager.parseGame: unmatched line: \"%s\"" % \
                          repr(line))
            moveno, wmove, whour, wmin, wsec, wmsec, bmove, bhour, bmin, bsec, bmsec = \
                moveListMoves.match(line).groups()
            whour = 0 if whour is None else int(whour[0])
            bhour = 0 if bhour is None else int(bhour[0])
            ply = int(moveno)*2-2
            if wmove:
                moves[ply] = wmove
                wms -= (int(whour) * 60 * 60 * 1000) + (int(wmin) * 60 * 1000) + (int(wsec) * 1000)
                if wmsec is not None:
                    wms -= int(wmsec)
                else:
                    wmsec = 0
                if int(moveno) > 1 and increment > 0:
                    wms += (increment * 1000)
                times[ply] = "%01d:%02d:%02d.%03d" % (int(whour), int(wmin), int(wsec), int(wmsec))
开发者ID:ggjj1122,项目名称:pychess,代码行数:67,代码来源:BoardManager.py


示例18: init_layout

    def init_layout(self):
        perspective_widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        perspective_manager.set_perspective_widget("games", perspective_widget)

        self.notebooks = {"board": cleanNotebook("board"),
                          "buttons": cleanNotebook("buttons"),
                          "messageArea": cleanNotebook("messageArea")}
        for panel in sidePanels:
            self.notebooks[panel.__name__] = cleanNotebook(panel.__name__)

        # Initing headbook

        align = gamewidget.createAlignment(4, 4, 0, 4)
        align.set_property("yscale", 0)

        headbook = Gtk.Notebook()
        headbook.set_name("headbook")
        headbook.set_scrollable(True)
        align.add(headbook)
        perspective_widget.pack_start(align, False, True, 0)
        self.show_tabs(not conf.get("hideTabs", False))

        # Initing center

        centerVBox = Gtk.VBox()

        # The dock

        self.dock = PyDockTop("main", self)
        self.dockAlign = gamewidget.createAlignment(4, 4, 0, 4)
        self.dockAlign.add(self.dock)
        centerVBox.pack_start(self.dockAlign, True, True, 0)
        self.dockAlign.show()
        self.dock.show()

        self.docks = {"board": (Gtk.Label(label="Board"), self.notebooks["board"])}
        for panel in sidePanels:
            box = dock_panel_tab(panel.__title__, panel.__desc__, panel.__icon__)
            self.docks[panel.__name__] = (box, self.notebooks[panel.__name__])

        if os.path.isfile(dockLocation):
            try:
                self.dock.loadFromXML(dockLocation, self.docks)
            except Exception as e:
                stringio = StringIO()
                traceback.print_exc(file=stringio)
                error = stringio.getvalue()
                log.error("Dock loading error: %s\n%s" % (e, error))
                widgets = gamewidget.getWidgets()
                msg_dia = Gtk.MessageDialog(widgets["main_window"],
                                            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(dockLocation)
                for title, panel in self.docks.values():
                    title.unparent()
                    panel.unparent()

        if not os.path.isfile(dockLocation):
            leaf = self.dock.dock(self.docks["board"][1],
                                  CENTER,
                                  Gtk.Label(label=self.docks["board"][0]),
                                  "board")
            self.docks["board"][1].show_all()
            leaf.setDockable(False)

            # S
            epanel = leaf.dock(self.docks["bookPanel"][1], SOUTH, self.docks["bookPanel"][0],
                               "bookPanel")
            epanel.default_item_height = 45
            epanel = epanel.dock(self.docks["engineOutputPanel"][1], CENTER,
                                 self.docks["engineOutputPanel"][0],
                                 "engineOutputPanel")

            # NE
            leaf = leaf.dock(self.docks["annotationPanel"][1], EAST,
                             self.docks["annotationPanel"][0], "annotationPanel")
            leaf = leaf.dock(self.docks["historyPanel"][1], CENTER,
                             self.docks["historyPanel"][0], "historyPanel")
            leaf = leaf.dock(self.docks["scorePanel"][1], CENTER,
                             self.docks["scorePanel"][0], "scorePanel")

            # SE
            leaf = leaf.dock(self.docks["chatPanel"][1], SOUTH, self.docks["chatPanel"][0],
                             "chatPanel")
            leaf = leaf.dock(self.docks["commentPanel"][1], CENTER,
                             self.docks["commentPanel"][0], "commentPanel")

        def unrealize(dock, notebooks):
            # unhide the panel before saving so its configuration is saved correctly
            self.notebooks["board"].get_parent().get_parent().zoomDown()
            dock.saveToXML(dockLocation)
            dock._del()

#.........这里部分代码省略.........
开发者ID:bboutkov,项目名称:pychess,代码行数:101,代码来源:__init__.py


示例19: open_lounge

    def open_lounge(self, connection, helperconn, host):
        if self.first_run:
            self.init_layout()

        self.connection = connection
        self.helperconn = helperconn
        self.host = host

        self.finger_sent = False
        self.messages = []
        self.players = []
        self.game_cids = {}

        self.widgets = uistuff.GladeWidgets("fics_lounge.glade")
        self.widgets["fics_lounge"].hide()

        fics_home = self.widgets["fics_home"]
        self.widgets["fics_lounge_content_hbox"].remove(fics_home)

        self.archive_list = self.widgets["archiveListContent"]
        self.widgets["fics_panels_notebook"].remove(self.archive_list)

        self.games_list = self.widgets["gamesListContent"]
        self.widgets["fics_panels_notebook"].remove(self.games_list)

        self.news_list = self.widgets["news"]
        self.widgets["fics_home"].remove(self.news_list)

        self.players_list = self.widgets["playersListContent"]
        self.widgets["fics_panels_notebook"].remove(self.players_list)

        self.seek_graph = self.widgets["seekGraphContent"]
        self.widgets["fics_panels_notebook"].remove(self.seek_graph)

        self.seek_list = self.widgets["seekListContent"]
        self.widgets["fics_panels_notebook"].remove(self.seek_list)

        self.seek_challenge = SeekChallengeSection(self)

        def on_autoLogout(alm):
            self.emit("autoLogout")
            self.close()

        self.connection.alm.connect("logOut", on_autoLogout)
        self.connection.connect("disconnected", lambda connection: self.close())
        self.connection.connect("error", self.on_connection_error)
        if self.connection.isRegistred():
            numtimes = conf.get("numberOfTimesLoggedInAsRegisteredUser") + 1
            conf.set("numberOfTimesLoggedInAsRegisteredUser", numtimes)
        self.connection.em.connect("onCommandNotFound", lambda em, cmd: log.error(
            "Fics answered '%s': Command not found" % cmd))
        self.connection.bm.connect("playGameCreated", self.onPlayGameCreated)
        self.connection.bm.connect("obsGameCreated", self.onObserveGameCreated)
        self.connection.bm.connect("exGameCreated", self.onObserveGameCreated)
        self.connection.fm.connect("fingeringFinished", self.onFinger)
        # the rest of these relay server messages to the lounge infobar
        self.connection.bm.connect("tooManySeeks", self.tooManySeeks)
        self.connection.bm.connect("nonoWhileExamine", self.nonoWhileExamine)
        self.connection.bm.connect("matchDeclined", self.matchDeclined)
        self.connection.bm.connect("player_on_censor", self.player_on_censor)
        self.connection.bm.connect("player_on_noplay", self.player_on_noplay)
        self.connection.bm.connect("req_not_fit_formula", self.req_not_fit_formula)
        self.connection.glm.connect("seek-updated", self.on_seek_updated)
        self.connection.glm.connect("our-seeks-removed", self.our_seeks_removed)
        self.connection.cm.connect("arrivalNotification", self.onArrivalNotification)
        self.connection.cm.connect("departedNotification", self.onDepartedNotification)

        def get_top_games():
            if perspective_manager.current_perspective == self:
                self.connection.client.run_command("games *19")
            return True

        if self.connection.ICC:
            self.event_id = GLib.timeout_add_seconds(5, get_top_games)

        for user in self.connection.notify_users:
            user = self.connection.players.get(user)
            self.user_from_notify_list_is_present(user)

        self.userinfo = UserInfoSection(self.widgets, self.connection, self.host, self)
        if not self.first_run:
            self.notebooks["ficshome"].remove_page(-1)
        self.notebooks["ficshome"].append_page(fics_home)

        self.panels = [panel.Sidepanel().load(self.widgets, self.connection, self) for panel in self.sidePanels]

        for panel, instance in zip(self.sidePanels, self.panels):
            if not self.first_run:
                self.notebooks[panel_name(panel.__name__)].remove_page(-1)
            self.notebooks[panel_name(panel.__name__)].append_page(instance)
            instance.show()

        tool_buttons = [self.logoff_button, ]
        self.quick_seek_buttons = []
        if self.connection.ICC:
            self.quick_seek_buttons = [self.minute_1_button, self.minute_3_button, self.minute_5_button,
                                       self.minute_15_button, self.minute_25_button, self.chess960_button]
            tool_buttons += self.quick_seek_buttons
        perspective_manager.set_perspective_toolbuttons("fics", tool_buttons)

#.........这里部分代码省略.........
开发者ID:leogregianin,项目名称:pychess,代码行数:101,代码来源:__init__.py


示例20: _get_curplayer

 def _get_curplayer (self):
     try:
         return self.players[self.getBoardAtPly(self.ply).color]
     except IndexError:
         log.error("%s %s\n" % (self.players, self.getBoardAtPly(self.ply).color))
         raise
开发者ID:jskurka,项目名称:PyChess-Learning-Module,代码行数:6,代码来源:GameModel.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.info函数代码示例发布时间:2022-05-25
下一篇:
Python log.debug函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap