py-stockfish / stockfish

Integrates the Stockfish chess engine with Python (Official fork)
https://py-stockfish.github.io/stockfish/
MIT License
32 stars 9 forks source link

Not working with newer versions of stockfish #11

Closed sandersfrank closed 1 year ago

sandersfrank commented 1 year ago

No problem with older versions, but newest versions cause the following error

Traceback (most recent call last): File "C:\Users\Helmut\PycharmProjects\pythonProject\pythonTestProjekte\Test1.py", line 2, in stockfish = Stockfish(path="D:\StockfishN.exe") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Helmut\PycharmProjects\pythonProject\pythonTestProjekte\venv\Lib\site-packages\stockfish\models.py", line 57, in init self._stockfish_major_version: int = int( ^^^^ ValueError: invalid literal for int() with base 10: 'dev20230202da8513f0'

kieferro commented 1 year ago

Thank you for reporting this bug. We will take care of it.

The problem is that the output of the development version build only contains a date code and no major version. We should change the way the major version is determined or catch the exception for the development build variant.

Sample output for development build:

Stockfish dev-20230329-3f01e3f4 by the Stockfish developers (see AUTHORS file)

Sample output for official build:

Stockfish 15.1 by the Stockfish developers (see AUTHORS file)

sugizo commented 1 year ago

step on google colab

!apt-get install -y stockfish curl unzip make git 

# stockfish official
!git clone https://github.com/official-stockfish/Stockfish
!cd Stockfish/src && make -j build ARCH=x86-64-modern
!cp Stockfish/src/stockfish /bin/stockfish

# asmfish
!git clone https://github.com/lantonov/asmFish
!chmod +x asmFish/LinuxOS_binaries/*
!cp asmFish/LinuxOS_binaries/asmFishL_10_base /bin/asmfish

# stockfish_mv (multi variant)
!git clone https://github.com/ddugovic/Stockfish
!cd Stockfish/src && make -j build ARCH=x86-64
!cp Stockfish/src/stockfish /bin/stockfish_mv

result

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-16-d7ed8b0317d3>](https://localhost:8080/#) in on_change_engine(self, change)
    117         with self.output_board_info:
    118             clear_output(wait = True)
--> 119             display(HTML(self.display_board_info(self.board) ) )
    120 
    121     def make_engine_list(self):

3 frames
[/usr/local/lib/python3.9/dist-packages/stockfish/models.py](https://localhost:8080/#) in __init__(self, path, depth, parameters)
     55         self._has_quit_command_been_sent = False
     56 
---> 57         self._stockfish_major_version: int = int(
     58             self._read_line().split(" ")[1].split(".")[0].replace("-", "")
     59         )

ValueError: invalid literal for int() with base 10: 'dev20230413f0fc36bf'

note asmfish, stockfish_mv from the same git repo run well on mac

best regards