私はpython-chessゲームをpgnファイルにエクスポートしようとしています。 documentationは推奨しています -python-chess - AttributeError:モジュール 'chess'に属性 '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: module 'chess' has no attribute 'pgn'
pgn
を私はchess.
を入力するときにもインテリセンスに表示さそうエディタも存在することを確認することができますpgn
のchess
。これは、Windows 10上のVS2015で実行されているPython 3.xです。
何が原因なのでしょうか?
を行う必要があるだろう
pgn
モジュールを使用するには、私は、エラーの同じ種類を持っていた: 'はAttributeError:「モジュール」オブジェクトには属性が「はいそれはそれを固定 – Purplejacket