Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work with this pgn structure? #2

Closed
03stories opened this issue Jun 21, 2022 · 3 comments
Closed

work with this pgn structure? #2

03stories opened this issue Jun 21, 2022 · 3 comments

Comments

@03stories
Copy link

I thought I'd give this a try with a pgn file I have, but I keep getting this error. Any help / pointers appreciated.

Traceback (most recent call last):
  File "chess_export.py", line 6, in <module>
    result = pgn_data.export()
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/pgn_data.py", line 59, in export
    result = self.__process_pgn_list(pgn_list, file)
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/pgn_data.py", line 91, in __process_pgn_list
    process.parse_file(add_headers)
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/process.py", line 96, in parse_file
    game_writer.writerow(self.__get_game_row_data(game, game_id, order, self.pgn_file))
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/process.py", line 164, in __get_game_row_data
    game.headers["BlackElo"] if winner == game.headers["Black"] else "")
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/chess/pgn.py", line 947, in __getitem__
    return self._others[key]
KeyError: 'BlackElo'

The pgn input file is this

[Date "2022.6.16"]
[Result "0-1"]
[White "Dr. Wolf - Intermediate"]
[Black "James"]

1. c4 1. d5 2. d4 2. e6 3. Nf3 3. c5 4. e3 4. Nc6 5. Nc3 5. Bd6 6. dxc5 6. Bxc5 7. g3 7. dxc4 8. Qa4 8. f6 9. Qb5 9. b6 10. Qxc4 10. Nge7 11. Ne4 11. Qd5 12. Qxd5 12. Nxd5 13. a3 13. f5 14. Bb5 14. Bd7 15. Bxc6 15. Bxc6 16. Ne5 16. Nxe3 17. Nxc6 17. Nc2+ 18. Ke2 18. Nxa1 19. Ng5 19. Nb3 20. Rd1 20. O-O 21. Be3 21. Rfe8 22. Bxc5 22. bxc5 23. Rd7 23. Nc1+ 24. Kd2 24. Nb3+ 25. Kc2 25. Nd4+ 26. Nxd4 26. cxd4 27. Kd3 27. e5 28. b3 28. Rab8 29. Kc4 29. Rec8+ 30. Kd3 30. Rxb3+ 31. Kd2 31. a5 32. Ne6 32. h6 33. Rxg7+ 33. Kh8 34. Rg6 34. Kh7 35. Rg7+ 35. Kh8 36. Rc7 36. Rc3 37. Rxc8+ 37. Rxc8 38. f4 38. e4 39. g4 39. Re8 40. Nc7 40. Re7 41. Nd5 41. e3+ 42. Kd3 42. Re4 43. Nxe3 43. dxe3 44. Ke2 44. fxg4 45. a4 45. Rxa4 46. Kxe3 46. h5 47. f5 47. Ra3+ 48. Kd2 48. Rf3 49. Ke2 49. Rxf5 50. Kd2 50. Rf2+ 51. Kd3 51. Rxh2 52. Ke3 52. a4 53. Kd4 53. g3 54. Kc4 54. a3 55. Kb3 55. a2 56. Kc4 56. a1=Q 57. Kd5 57. Qa2+ 58. Ke4 58. Qc2+ 59. Kf3 59. Qd3+ 60. Kf4 60. Rf2+ 61. Ke5 61. Rf5+ 62. Ke6 62. Qd5+ 63. Ke7 63. Rf7+ 64. Ke8 64. Qd7 0-1
@davidsamuelwhite
Copy link

I'm having the same issue.

@zq99
Copy link
Owner

zq99 commented Jun 24, 2022

I thought I'd give this a try with a pgn file I have, but I keep getting this error. Any help / pointers appreciated.

Traceback (most recent call last):
  File "chess_export.py", line 6, in <module>
    result = pgn_data.export()
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/pgn_data.py", line 59, in export
    result = self.__process_pgn_list(pgn_list, file)
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/pgn_data.py", line 91, in __process_pgn_list
    process.parse_file(add_headers)
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/process.py", line 96, in parse_file
    game_writer.writerow(self.__get_game_row_data(game, game_id, order, self.pgn_file))
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/converter/process.py", line 164, in __get_game_row_data
    game.headers["BlackElo"] if winner == game.headers["Black"] else "")
  File "/Users/james/.pyenv/versions/3.7.8/lib/python3.7/site-packages/chess/pgn.py", line 947, in __getitem__
    return self._others[key]
KeyError: 'BlackElo'

The pgn input file is this

[Date "2022.6.16"]
[Result "0-1"]
[White "Dr. Wolf - Intermediate"]
[Black "James"]

1. c4 1. d5 2. d4 2. e6 3. Nf3 3. c5 4. e3 4. Nc6 5. Nc3 5. Bd6 6. dxc5 6. Bxc5 7. g3 7. dxc4 8. Qa4 8. f6 9. Qb5 9. b6 10. Qxc4 10. Nge7 11. Ne4 11. Qd5 12. Qxd5 12. Nxd5 13. a3 13. f5 14. Bb5 14. Bd7 15. Bxc6 15. Bxc6 16. Ne5 16. Nxe3 17. Nxc6 17. Nc2+ 18. Ke2 18. Nxa1 19. Ng5 19. Nb3 20. Rd1 20. O-O 21. Be3 21. Rfe8 22. Bxc5 22. bxc5 23. Rd7 23. Nc1+ 24. Kd2 24. Nb3+ 25. Kc2 25. Nd4+ 26. Nxd4 26. cxd4 27. Kd3 27. e5 28. b3 28. Rab8 29. Kc4 29. Rec8+ 30. Kd3 30. Rxb3+ 31. Kd2 31. a5 32. Ne6 32. h6 33. Rxg7+ 33. Kh8 34. Rg6 34. Kh7 35. Rg7+ 35. Kh8 36. Rc7 36. Rc3 37. Rxc8+ 37. Rxc8 38. f4 38. e4 39. g4 39. Re8 40. Nc7 40. Re7 41. Nd5 41. e3+ 42. Kd3 42. Re4 43. Nxe3 43. dxe3 44. Ke2 44. fxg4 45. a4 45. Rxa4 46. Kxe3 46. h5 47. f5 47. Ra3+ 48. Kd2 48. Rf3 49. Ke2 49. Rxf5 50. Kd2 50. Rf2+ 51. Kd3 51. Rxh2 52. Ke3 52. a4 53. Kd4 53. g3 54. Kc4 54. a3 55. Kb3 55. a2 56. Kc4 56. a1=Q 57. Kd5 57. Qa2+ 58. Ke4 58. Qc2+ 59. Kf3 59. Qd3+ 60. Kf4 60. Rf2+ 61. Ke5 61. Rf5+ 62. Ke6 62. Qd5+ 63. Ke7 63. Rf7+ 64. Ke8 64. Qd7 0-1

Hi,

This issue has hopefully been resolved with the latest release.

Please install the latest version (0.0.5)

Thanks,

@zq99 zq99 closed this as completed Jun 24, 2022
@03stories
Copy link
Author

Thank you! Works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants