Я пытаюсь экспортировать игру в шахматы на питоне в файл pgn. документация рекомендует:
import chess
.
.
chessBoard = chess.Board()
.
.
#Play the game and when over do below
game = chess.pgn.Game.from_board(chessBoard)
with open('output.pgn', 'a') as the_file:
print(game, file=the_file, end="\n\n")
Но строка chess.pgn.Game.from_board(chessBoard)
выдает следующую ошибку:
AttributeError: модуль «шахматы» не имеет атрибута «pgn»
pgn
также отображается в intellisense, когда я набираю chess.
, поэтому редактор также может видеть, что в chess
есть pgn
. Это python 3.x, работающий в VS2015 на Windows 10.
Что может быть причиной этого?
AttributeError: 'module' object has no attribute 'svg'
- person Purplejacket   schedule 16.04.2017