lichess-bot-devs / lichess-bot

A bridge between Lichess bots and chess engines
GNU Affero General Public License v3.0
763 stars 445 forks source link

NameError: name 'logger' is not defined #160

Closed eldebarva closed 4 years ago

eldebarva commented 5 years ago

I am having trouble making the program play. Hopefully it is something easy to solve.

2018-12-13 12:16:07 __main__[16152] INFO
    .   _/|
    .  // o\
    .  || ._)  lichess-bot 1.1.1
    .  //__\
    .  )___(   Play on Lichess with a bot

2018-12-13 12:16:08 __main__[16152] INFO Welcome GilgameshTheBot!
2018-12-13 12:16:08 __main__[16152] INFO You're now connected to https://lichess.org/ and awaiting challenges.
2018-12-13 12:16:33 __main__[16152] INFO --- Process Used. Total Queued: 0. Total Used: 1
2018-12-13 12:18:15 __main__[16152] INFO --- Process Used. Total Queued: 0. Total Used: 2
2018-12-13 12:20:48 __main__[16152] INFO --- Process Used. Total Queued: 0. Total Used: 3
2018-12-13 12:24:55 __main__[16152] INFO     Decline Correspondence casual challenge from smccurley(1500)
Traceback (most recent call last):
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "C:\Users\Rolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\backoff\_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\lichess-bot.py", line 135, in play_game
    logger.info("+++ {}".format(game))
NameError: name 'logger' is not defined

Traceback (most recent call last):
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "C:\Users\Rolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\backoff\_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\lichess-bot.py", line 135, in play_game
    logger.info("+++ {}".format(game))
NameError: name 'logger' is not defined

Traceback (most recent call last):
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "C:\Users\Rolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\backoff\_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\lichess-bot.py", line 135, in play_game
    logger.info("+++ {}".format(game))
NameError: name 'logger' is not defined
eldebarva commented 5 years ago

This is my config.yml

token: "..."    # lichess OAuth2 Token
url: "https://lichess.org/"  # lichess base URL

engine:                      # engine settings
  dir: "./engines/"          # dir containing engines, relative to this project
  name: "Rybka3Human.exe"    # binary name of the engine to use
  protocol: "uci"            # "uci" or "xboard"
  polyglot:
    enabled: false           # activate polyglot book
    book:
#     standard: "engines/book.bin" # book file path of standard chess
#      atomic: "atomic book path"
#      giveaway: "antichess book path"
#      crazyhouse: "crazyhouse book path"
#      horde: "horde book path"
#      kingofthehill: "kingOfTheHill book path"
#      racingkings: "racingKings book path"
#      3check: "threeCheck book path"
    max_depth: 20             # half move max depth
    min_weight: 1            # selects move with highest weight but not below this value
    selection: "weighted_random" # move slection is one of "weighted_random", "uniform_random" or "best_move" (but not below the min_weight in 2. and 3. case)
  uci_options:               # arbitrary UCI options passed to the engine
    Move Overhead: 100       # increase if your bot flags games too often
    Threads: 2               # max CPU threads the engine can use
    Hash: 256                # max memory (in megabytes) the engine can allocate
#   go_commands:             # additional options to pass to the UCI go command
#     nodes: 1               # Search so many nodes only.
#     depth: 5               # Search depth ply only.
#     movetime: 1000         # Integer. Search exactly movetime milliseconds.
# xboard_options:            # arbitrary xboard options passed to the engine
#   cores: "4"
#   memory: "4096"
#   egtpath:                 # dir containing egtb, relative to this project
#     gaviota: "Gaviota path"
#     nalimov: "Nalimov Path"
#     scorpio: "Scorpio Path"
#     syzygy: "Syzygy Path"
# lczero:                    # lczero specific settings
#   weights: "engines/latest.txt" # weights file path
#   threads: 1               # max CPU threads the engine can use
#   gpu: 0                   # which GPU to use
#   tempdecay: 10            # After search is complete, the tempdecay can pick slightly weaker moves to offer variety. 10 is good tradeoff
#   noise: true              # Randomness in the search algorithm. This makes sure that even unfavored lines are given a "lucky" shot
#   log: "./engines/log.txt" # save log of lczero debug output
  silence_stderr: false      # some engines (yes you, leela) are very noisy

abort_time: 20               # time to abort a game in seconds when there is no activity
fake_think_time: false       # artificially slow down the bot to pretend like it's thinking

challenge:                   # incoming challenges
  concurrency: 1             # number of games to play simultaneously
  sort_by: "best"            # possible values: "best", "first"
  accept_bot: false          # accepts challenges coming from other bots
  max_increment: 180         # maximum amount of increment to accaept a challenge. the max is 180. set to 0 for no increment
  min_increment: 0           # minimum amount of increment to accept a challenge
  variants:                  # chess variants to accept (http://lichess.org/variant)
    - standard
#   - fromPosition
#   - antichess
#   - atomic
#   - chess960
#   - crazyhouse
#   - horde
#   - kingOfTheHill
#   - racingKings
#   - threeCheck
  time_controls:             # time controls to accept
    - ultraBullet
    - bullet
    - blitz
    - rapid
#   - classical
#   - correspondence
  modes:                     # game modes to accept
    - casual                 # unrated games
    - rated                  # rated games - must comment if the engine doesn't try to win

It is also worth to mension this werid message __main__[16152] �[1mINFO�[0m that appears before the expected messages. Also,

Traceback (most recent call last):
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\logging_pool.py", line 16, in __call__
    result = self.__callable(*args, **kwargs)
  File "C:\Users\Rolo\AppData\Local\Programs\Python\Python37-32\lib\site-packages\backoff\_sync.py", line 99, in retry
    ret = target(*args, **kwargs)
  File "C:\Users\Rolo\Desktop\Ajedrez\Bot\lichess-bot-master\lichess-bot.py", line 135, in play_game
    logger.info("+++ {}".format(game))
NameError: name 'logger' is not defined

appears like 10 minutes after the program accepts a challenge, or sometimes it never shows up until I press control+c.

ShailChoksi commented 5 years ago

Can you pull https://github.com/careless25/lichess-bot/pull/162 and check if its fixed?

eldebarva commented 5 years ago

Yes, now the engine actually plays, thank you! However, in the cmd it never desplays the message containing the link to the game.