zeFresk / deep-position-analysis

To analyse a chess position in depth using powerfull engines
MIT License
20 stars 1 forks source link

Bug found in the script #8

Open magicianfromriga opened 2 years ago

magicianfromriga commented 2 years ago

Hi, This is a bug that I got when I tried to run the script.

D:\Chess\deep-position-analysis> python dpa.py --engine "stockfish2206.exe" --depth 2 'French Poisoned Pawn_Schwarz_2022.pgn' --appending --threshold 1.00 --cutoff 0.50 --nodes 10000000 D:\Chess\deep-position-analysis\dpa.py:5: DeprecationWarning: The chess.uci module is deprecated in favor of chess.engine https://python-chess.readthedocs.io/en/latest/engine.html.

Please consider updating and open an issue https://github.com/niklasf/python-chess/issues/new if your use case is not covered by the new API. import chess.uci Setting-up engine PGN input detected we will only analyze from last position(s) reached. Traceback (most recent call last): File "D:\Chess\deep-position-analysis\dpa.py", line 100, in asyncio.run(main()) File "C:\Program Files\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "D:\Chess\deep-position-analysis\dpa.py", line 58, in main fens = fens_from_file(filename) File "D:\Chess\deep-position-analysis\files.py", line 33, in fens_from_file board.push(move) File "C:\Program Files\Python310\lib\site-packages\chess__init.py", line 1906, in push move = self._to_chess960(move) File "C:\Program Files\Python310\lib\site-packages\chess\init__.py", line 3252, in _to_chess960 if move.from_square == E1 and self.kings & BB_E1: AttributeError: 'GameNode' object has no attribute 'from_square'

This is what I got when I tried to run the script.

Python 3.10.5 Python Chess 0.25.1

zeFresk commented 2 years ago

Hi,

As the logs suggest, I don't think this is a bug from my program. As stated in the README, you need to install python-chess 0.23 using pip install python-chess==0.23.10. This tool needs to be rewritten for the latest version of python-chess but the API of the module keeps changing after each new version... I already updated the code once to use the latest version of python-chess at the time, but every update seems to break everything. IMO this is a bad design decision on their part as I think guaranteeing backward compatibility is important as a module owner.

Could you please try to install python-chess 0.23.10 instead to see if it fixes the error please ?

magicianfromriga commented 2 years ago

Traceback (most recent call last): File "D:\Chess\deep-position-analysis\dpa.py", line 4, in import chess.pgn File "C:\Users\USER\AppData\Roaming\Python\Python310\site-packages\chess\pgn.py", line 510, in class Headers(collections.MutableMapping): AttributeError: module 'collections' has no attribute 'MutableMapping'

This is the error I am getting when I change the python-chess version

zeFresk commented 2 years ago

I didn't try to use this program with Python 3.10. It could be the root of the problem. If that's the case I will need to update this project to use the latest version of python-chess...

Sadly, I'm very busy at the moment but I will try to fix the problem within a month. The only temporary solution I can provide would be to use an older version of Python.

magicianfromriga commented 2 years ago

Thanks for the response! I appreciate you taking the time to provide answers though you are quite busy at the moment. You can please take your time and try to resolve this at a later point!