You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "<python-input-2>", line 1, in <module>
board.set_piece_at(0, chess.KNIGHT)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\chess\__init__.py", line 1816, in set_piece_at
super().set_piece_at(square, piece, promoted=promoted)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\chess\__init__.py", line 1090, in set_piece_at
self._set_piece_at(square, piece.piece_type, piece.color, promoted)
^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'piece_type'
Reason: You're feeding a PieceType chess.KNIGHT into a function that needs a Optional[Piece] which you can construct by using Piece(chess.KNIGHT, color)
Activity
winapiadmin commentedon Nov 2, 2025
Reason: You're feeding a
PieceType chess.KNIGHTinto a function that needs aOptional[Piece]which you can construct by usingPiece(chess.KNIGHT, color)Docstrings are purely not needed for this.