fsmosca / chess-artist

A python script that can annotate chess games in pgn file with static evaluation or search score of an engine, can annotate an epd file with acd, acs, bm, and ce opcodes, can test engine with epd test suite and can generate chess puzzles.
GNU General Public License v3.0
69 stars 18 forks source link

Errors in some games #82

Closed Kraulfisch closed 3 years ago

Kraulfisch commented 3 years ago

Hey, after creating thousands of puzzles, I got one error multiple times:

Traceback (most recent call last): File "chess_artist.py", line 2717, in main() File "chess_artist.py", line 2708, in main g.CreatePuzzle() File "chess_artist.py", line 2536, in CreatePuzzle game = chess.pgn.read_game(h) File "C:\Users\Raoul Sidler\anaconda3\lib\site-packages\chess\pgn.py", line 1661, in read_game line = handle.readline() File "C:\Users\Raoul Sidler\anaconda3\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 3765: character maps to

It doesn't really bother me, becauese I just edit the pgn file and delete every analyzed game and continue running the programm, I just wanted to report it to you.

The PGN where it happened were the following:

[Event "Graz Open A 2016"] [Site "Graz AUT"] [Date "2016.02.18"] [Round "8.1"] [White "Turov, Maxim"] [Black "Li, Chao2"] [Result "0-1"] [WhiteElo "2603"] [BlackElo "2751"] [ECO "D17"] [EventDate "2016.02.12"] [WhiteTitle "GM"] [BlackTitle "GM"] [Opening "QGD Slav"] [Variation "Krause attack"] [WhiteFideId "4120086"] [BlackFideId "8604436"]

1.d4 d5 2.c4 c6 3.Nc3 Nf6 4.Nf3 dxc4 5.a4 Bf5 6.Ne5 Na6 7.f3 Nd7 8.Nxd7 Bxd7 9.e4 e5 10.Bxc4 exd4 11.Ne2 Be6 12.Bxa6 Qa5+ 13.Kf2 bxa6 14.Nxd4 Rd8 15.Be3 Bc5 16.Rc1 Bb6 17.b3 Qb4 0-1

and

[Event "TCh-ESP Div Honor 2014"] [Site "Linares ESP"] [Date "2014.09.04"] [Round "1.4"] [White "Antipov, Mikhail Al"] [Black "Salgado Lopez, Ivan"] [Result "1-0"] [WhiteElo "2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ojan"] [Black "Jovanovic, Zoran CRO"] [Result "1/2-1/2"] [WhiteElo "2511"] [BlackElo "2561"] [ECO "E60"] [EventDate "2014.10.04"] [WhiteTitle "GM"] [BlackTitle "GM"] [Opening "King's Indian, 3.Nf3"] [WhiteTeam "GSK SOLIN-CEMEX Solin"] [BlackTeam "SK LIBURNIJA Rijeka"] [WhiteFideId "14400057"] [BlackFideId "14505320"] [EventType "team-tourn"]

1.Nf3 Nf6 2.d4 g6 3.c4 Bg7 4.g3 c5 5.Bg2 O-O 6.O-O cxd4 7.Nxd4 d5 8.cxd5 Nxd5 9.Nc3 Nxc3 10.bxc3 Qc7 11.Rb1 Nc6 12.Nxc6 bxc6 13.Qa4 Bf5 14.e4 Be6 15.Bf4 Be5 16.Be3 Bxc3 17.Rfc1 Qa5 18.Qxa5 Bxa5 19.Rxc6 Bb6 20.Bxb6 axb6 21.Rcxb6 Rxa2 22.h4 Rd8 23.Rb8 Rd2 24.Rxd8+ Rxd8 25.Rb7 Rd7 26.Rxd7 Bxd7 27.f4 f6 28.Kf2 e5 29.fxe5 fxe5 30.Bf3 Kf7 1/2-1/2

There was also one which I didn't saved, but the FEN was this: 5k2/8/p2K1P2/Pp2R2B/8/8/2p5/1r6 b and Black played Rd1+ as the last move.

Kraulfisch commented 3 years ago

Also happened in this game:

[Event "6. Rethymno Open 2014"] [Site "Rethymno GRE"] [Date "2014.07.19"] [Round "9.6"] [White "Rychagov, A"] [Black "Zinchenko, Yaroslav"] [Result "1/2-1/2"] [WhiteElo "2543"] [BlackElo "2532"] [ECO "D85"] [EventDate "2014.07.12"] [WhiteTitle "GM"] [BlackTitle "GM"] [Opening "Gruenfeld"] [Variation "exchange variation"] [WhiteFideId "4119932"] [BlackFideId "14110547"]

1.d4 Nf6 2.c4 g6 3.Nc3 d5 4.cxd5 Nxd5 5.Bd2 Nb6 6.e4 Qxd4 7.Qc2 Nc6 8.Nf3 Qc5 9.Be3 Qa5 10.Bd2 Qc5 11.Be3 1/2-1/2

fsmosca commented 3 years ago

Thanks I will check these games. This is related to the library python-chess package that chess_artist is using.

fsmosca commented 3 years ago

I copy paste your posted game and it worked just fine.

If you can share your pgn file, I might be able to duplicate this issue.

Kraulfisch commented 3 years ago

core10.txt

Sure. In this file it happened at Game number 3027. I can also upload the other ones, if you want them.

fsmosca commented 3 years ago

Thanks I got the file and able to reproduce the error.

Will upload the fix later. I am testing it with 500K games from weekinchess from year 2018 to 2020.

fsmosca commented 3 years ago

This is now fix in chess artist v2.30.0. Tested with 500K games without errors.

If you encounter pgn errors send me the file.