rpdelaney-archive / python-chess-annotator

Reads chess games in PGN format and adds annotations using an engine
GNU General Public License v3.0
62 stars 29 forks source link

Setting ACPL headers on a root node fails due to new validation in python-chess #20

Closed clicketyclack closed 6 years ago

clicketyclack commented 6 years ago

Running the annotator now gives an exception:

$ python3 -m annotator -f Olafsson.pgn -g 0.01

An unhandled exception occurred: <class 'TypeError'>
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/shifty/github/cc-python-chess-annotator/annotator/__main__.py", line 759, in <module>
    main()
  File "/home/shifty/github/cc-python-chess-annotator/annotator/__main__.py", line 749, in main
    raise e
  File "/home/shifty/github/cc-python-chess-annotator/annotator/__main__.py", line 743, in main
    analyzed_game = analyze_game(game, args.gametime, args.engine, args.threads)
  File "/home/shifty/github/cc-python-chess-annotator/annotator/__main__.py", line 642, in analyze_game
    game = add_acpl(game, root_node)
  File "/home/shifty/github/cc-python-chess-annotator/annotator/__main__.py", line 490, in add_acpl
    node.root().headers["WhiteACPL"] = round(acpl(white_cpl))
  File "/home/shifty/github/cc-python-chess-annotator/lib/python3.6/site-packages/chess/pgn.py", line 532, in __setitem__
    elif "\n" in value or "\r" in value:
TypeError: argument of type 'int' is not iterable
$ 

Seems to be due to value validation niklasf/python-chess@c19acb9768b0eaf32cbeef4bb0af18b50d952c9c