[Python] Python-chess library piece_type_at() not working [closed]

Discussão em 'Python' iniciado por Stack, Abril 23, 2025.

  1. Stack

    Stack Membro Participativo

    EDIT: Solved, in the actual code I had accidentally written chess.Board rather than chess.Board()

    Using the python chess library (import chess), I am trying to use the following code to get the type of piece on the square A1:

    import chess
    gameboard = chess.Board()
    print(gameboard.piece_type_at(chess.A1))


    However, for me this brings up the following error: "TypeError: BaseBoard.piece_type_at() missing 1 required positional argument: 'square'"

    I don't understand why this is. After all, I passed the argument of chess.A1 and it's saying I'm missing an argument? Please help

    Continue reading...

Compartilhe esta Página