Does not work installed to a domain subdirectory
jhanley-com opened this issue · comments
I cloned your repo and then published it to my site as https://cdn.jhanley.com/ChessMatchViewer/chess.html
The problem is caused by publishing the project to the subdirectory "ChessMatchViewer".
The following error is displayed:
error during pgn parsing Traceback (most recent call last): File "/lib/python3.10/site-packages/chess/pgn.py", line 1682, in read_game move = visitor.parse_san(board_stack[-1], token) File "/lib/python3.10/site-packages/chess/pgn.py", line 1059, in parse_san return board.parse_san(san) File "/lib/python3.10/site-packages/chess/__init__.py", line 3038, in parse_san raise ValueError(f"illegal san: {san!r} in {self.fen()}") ValueError: illegal san: 'h1' in rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
The solution is to make the ".pgn" files relative.
Changes for chess_script.py. Change the paths from "/" to "./".
Line 86:
def load_games(pgn_location = "./kasparov-deep-blue-1997.pgn"):
Line 158:
files = ["./spassky_bronstein_1960.pgn", "./fischer_larsen_1971.pgn", "./kasparov-deep-blue-1997.pgn"]