Message331896
See new code example (little changed):
It block after first stdout:
import asyncio
import sys
async def run_stockfish():
STOCKFISH_PATH = r'C:\root\chess\stockfish\stockfish 10\stockfish_10_x64_bmi2.exe'
stockfish = await asyncio.subprocess.create_subprocess_exec(
STOCKFISH_PATH,
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
stockfish.stdin.write('uci'.encode())
while not stockfish.stdout.at_eof():
# BUG? - blocks at this line
line = await stockfish.stdout.readline()
print(line.decode())
await stockfish.wait()
if sys.platform == "win32":
asyncio.set_event_loop_policy(
asyncio.WindowsProactorEventLoopPolicy())
asyncio.run(run_stockfish(), debug=True)
Output:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32
runfile('C:/Users/Cezary Wagner/PycharmProjects/cw_chess_uci/sandbox/async_proxy/s01_async_stockfish.py', wdir='C:/Users/Cezary Wagner/PycharmProjects/cw_chess_uci/sandbox/async_proxy')
Stockfish 10 64 BMI2 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
Valid output is:
C:\Users\Cezary Wagner>"C:\root\chess\stockfish\stockfish 10\stockfish_10_x64_bmi2.exe"
Stockfish 10 64 BMI2 by T. Romstad, M. Costalba, J. Kiiski, G. Linscott
uci
id name Stockfish 10 64 BMI2
id 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
option name Analysis Contempt type combo default Both var Off var White var Black var Both
option name Threads type spin default 1 min 1 max 512
option name Hash type spin default 16 min 1 max 131072
option name Clear Hash type button
option name Ponder type check default false
option name MultiPV type spin default 1 min 1 max 500
option name Skill Level type spin default 20 min 0 max 20
option name Move Overhead type spin default 30 min 0 max 5000
option name Minimum Thinking Time type spin default 20 min 0 max 5000
option name Slow Mover type spin default 84 min 10 max 1000
option name nodestime type spin default 0 min 0 max 10000
option name UCI_Chess960 type check default false
option name UCI_AnalyseMode type check default false
option name SyzygyPath type string default <empty>
option name SyzygyProbeDepth type spin default 1 min 1 max 100
option name Syzygy50MoveRule type check default true
option name SyzygyProbeLimit type spin default 7 min 0 max 7
uciok |
|
Date |
User |
Action |
Args |
2018-12-15 11:09:09 | Cezary.Wagner | set | recipients:
+ Cezary.Wagner, paul.moore, tim.golden, asvetlov, zach.ware, yselivanov, steve.dower |
2018-12-15 11:09:09 | Cezary.Wagner | set | messageid: <1544872149.6.0.788709270274.issue35268@psf.upfronthosting.co.za> |
2018-12-15 11:09:09 | Cezary.Wagner | link | issue35268 messages |
2018-12-15 11:09:08 | Cezary.Wagner | create | |
|