Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test chess.engine under Cygwin #1047

Open
niklasf opened this issue Sep 24, 2023 · 0 comments
Open

Test chess.engine under Cygwin #1047

niklasf opened this issue Sep 24, 2023 · 0 comments
Labels
bug engine Chess engine integration

Comments

@niklasf
Copy link
Owner

niklasf commented Sep 24, 2023

Bug report received via email:

import chess
import chess.engine
import logging
import asyncio

logging.basicConfig(level=logging.DEBUG)
engine = chess.engine.SimpleEngine.popen_uci("stockfish") # ./stockfish15.exe")
board = chess.Board("r1bqkbnr/p1pp1ppp/1pn5/4p3/2B1P3/5Q2/PPPP1PPP/RNB1K1NR w KQkq - 2 4")
info = engine.analyse(board, chess.engine.Limit(depth=20))
print("Score:", info["score"])
DEBUG:asyncio:Using selector: PollSelector
DEBUG:chess.engine:Using PollingChildWatcher
DEBUG:chess.engine:<UciProtocol (pid=1560)>: Connection made
DEBUG:chess.engine:<UciProtocol (pid=1560)>: << uci
DEBUG:chess.engine:<UciProtocol (pid=1560)>: >> Stockfish 15 by the Stockfish developers (see AUTHORS file)
DEBUG:chess.engine:<UciProtocol (pid=1560)>: Process exited
DEBUG:chess.engine:<UciProtocol (pid=1560)>: Connection lost (exit code: 0, error: None)
Traceback (most recent call last):
  File "/home/user/chess/repro.py", line 7, in <module>
    engine = chess.engine.SimpleEngine.popen_uci("./stockfish15.exe")
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 3054, in popen_uci
    return cls.popen(UciProtocol, command, timeout=timeout, debug=debug, setpgrp=setpgrp, **popen_args)
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 3046, in popen
    return run_in_background(background, name=f"{cls.__name__} (command={command!r})", debug=debug)
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 201, in run_in_background
    return future.result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/usr/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 195, in background
    asyncio.run(coroutine(future))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 3038, in background
    await asyncio.wait_for(protocol.initialize(), timeout)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 1510, in initialize
    return await self.communicate(UciInitializeCommand)
  File "/usr/local/lib/python3.9/site-packages/chess/engine.py", line 1133, in communicate
    return await command.result
chess.engine.EngineTerminatedError: engine process died unexpectedly (exit code: 0)
@niklasf niklasf added bug engine Chess engine integration labels Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug engine Chess engine integration
Projects
None yet
Development

No branches or pull requests

1 participant