-
-
Notifications
You must be signed in to change notification settings - Fork 555
Description
I noticed the error when I tried to use gaviota TBs for which my user does not have write permissions. python-chess then crashes with this error:
File "/home/torsten/chess/BotLi/.venv/lib/python3.14/site-packages/chess/gaviota.py", line 1530, in probe_dtm
dtm = self._probe_dtm_no_ep(board)
File "/home/torsten/chess/BotLi/.venv/lib/python3.14/site-packages/chess/gaviota.py", line 1559, in _probe_dtm_no_ep
dtm = self._tb_probe(req)
File "/home/torsten/chess/BotLi/.venv/lib/python3.14/site-packages/chess/gaviota.py", line 1705, in _tb_probe
stream = self._setup_tablebase(req)
File "/home/torsten/chess/BotLi/.venv/lib/python3.14/site-packages/chess/gaviota.py", line 1659, in _setup_tablebase
return self._open_tablebase(req)
~~~~~~~~~~~~~~~~~~~~^^^^^
File "/home/torsten/chess/BotLi/.venv/lib/python3.14/site-packages/chess/gaviota.py", line 1666, in _open_tablebase
stream = open(path, "rb+")
PermissionError: [Errno 13] Permission denied: '/gaviota/kqpkr.gtb.cp4'I noticed that TBs have been opened with write permissions since 694c038. I wonder if this is necessary, since they never actually need to be written to, AFAIK.
A brief test with this change in line 1666 of gaviota.py worked for me:
if stream is None:
path = self.available_tables[req.egkey]
- stream = open(path, "rb+")
+ stream = open(path, "rb")
self.egtb_loadindexes(req.egkey, stream)
self.streams[req.egkey] = streamEdit:
One more note: Installing the shared library as described in the documentation no longer seems to work. The Makefile installs the library to /usr/local/lib, but my system does not seem to search there. I don't know if this is a quirk of my Linux distribution. I use CachyOS.
In any case, python-chess falls back to the Python version even after installing the library.
INFO:chess.gaviota:Falling back to pure Python tablebase: OSError('libgtb.so.1.0.1: cannot open shared object file: No such file or directory')