thomasahle / sunfish

Sunfish: a Python Chess Engine in 111 lines of code
https://www.chessprogramming.org/Sunfish
Other
2.95k stars 543 forks source link

Not able to run on Windows 10 #113

Open prashant-saxena opened 10 months ago

prashant-saxena commented 10 months ago

When using Python 3.12.0

D:\projects\sunfish\tools>python fancy.py -cmd d:\projects\sunfish\sunfish.py
Traceback (most recent call last):
  File "D:\projects\sunfish\tools\fancy.py", line 284, in <module>
    asyncio.run(main())
  File "C:\Python312\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 664, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\projects\sunfish\tools\fancy.py", line 234, in main
    engine = await load_engine_from_cmd(args.cmd, debug=args.debug)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\projects\sunfish\tools\fancy.py", line 40, in load_engine_from_cmd
    _, engine = await chess.engine.popen_uci(cmd.split())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\chess\engine.py", line 2679, in popen_uci
    transport, protocol = await UciProtocol.popen(command, setpgrp=setpgrp, **popen_args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\site-packages\chess\engine.py", line 1239, in popen
    return await asyncio.get_running_loop().subprocess_exec(cls, *command, **popen_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_events.py", line 1708, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\windows_events.py", line 399, in _make_subprocess_transport
    transp = _WindowsSubprocessTransport(self, protocol, args, shell,
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "C:\Python312\Lib\asyncio\windows_events.py", line 873, in _start
    self._proc = windows_utils.Popen(
                 ^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\asyncio\windows_utils.py", line 153, in __init__
    super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
  File "C:\Python312\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python312\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application

when using pypy3.10-v7.3.13-win64

D:\projects\sunfish\tools>pypy3 fancy.py -cmd d:\projects\sunfish\sunfish.py
Traceback (most recent call last):
  File "D:\projects\sunfish\tools\fancy.py", line 284, in <module>
    asyncio.run(main())
  File "C:\pypy3\Lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pypy3\Lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\pypy3\Lib\asyncio\futures.py", line 201, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "C:\pypy3\Lib\asyncio\tasks.py", line 232, in __step
    result = coro.send(None)
             ^^^^^^^^^^^^^^^
  File "D:\projects\sunfish\tools\fancy.py", line 234, in main
    engine = await load_engine_from_cmd(args.cmd, debug=args.debug)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\projects\sunfish\tools\fancy.py", line 40, in load_engine_from_cmd
    _, engine = await chess.engine.popen_uci(cmd.split())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pypy3\lib\site-packages\chess\engine.py", line 2679, in popen_uci
    transport, protocol = await UciProtocol.popen(command, setpgrp=setpgrp, **popen_args)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pypy3\lib\site-packages\chess\engine.py", line 1239, in popen
    return await asyncio.get_running_loop().subprocess_exec(cls, *command, **popen_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\pypy3\Lib\asyncio\base_events.py", line 1681, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\pypy3\Lib\asyncio\windows_events.py", line 399, in _make_subprocess_transport
    transp = _WindowsSubprocessTransport(self, protocol, args, shell,
  File "C:\pypy3\Lib\asyncio\base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "C:\pypy3\Lib\asyncio\windows_events.py", line 901, in _start
    self._proc = windows_utils.Popen(
  File "C:\pypy3\Lib\asyncio\windows_utils.py", line 153, in __init__
    super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
  File "C:\pypy3\Lib\subprocess.py", line 986, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\pypy3\Lib\subprocess.py", line 1484, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
  File "C:\pypy3\Lib\_winapi.py", line 307, in CreateProcess
    raise_WinError()
  File "C:\pypy3\Lib\_winapi.py", line 36, in raise_WinError
    raise excep
OSError: [WinError 193] %1 is not a valid Win32 application