I try to access the Stockfish engine via Python, but only get bestmove = a2a3. If I enter the same commands into the MAC-terminal, the engine calculates the correct move. Can anyone help me, please ?
My Python code is:
p = subprocess.Popen('/Applications/TigerJython/LuChess/Stockfish/stockfish-11-mac/Mac/stockfish-11-64', stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
p.stdin.write("uci\n")
p.stdin.write("ucinewgame\n")
p.stdin.write("position startpos moves e2e4 e7e5\n")
p.stdin.write("go infinite\n")
p.stdin.flush()
print(p.communicate())
The result is shown below:
('Stockfish 11 64 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
id name Stockfish 11 64\nid author T. Romstad, M. Costalba, J. Kiiski, G. Linscott
option name Debug Log File type string default
option name Contempt type spin default 24 min -100 max 100
...
uciok
bestmove a2a3
None