Search code examples
pythonchesspython-chess

AttributeError: module 'chess' has no attribute 'Board' chess board error


i'm making chess in python i'm having this error

this my code:

import chess.board

board=chess.Board()

board

full error:

Traceback (most recent call last):
  File "chess.py", line 1, in <module>
    import chess
  File "D:\Websites\repoting\chess.py", line 3, in <module>
    board=chess.Board()
AttributeError: module 'chess' has no attribute 'Board'

Solution

  • If you import chess you can use chess.Board(). But if you import chess.Board you could only use Board()from module chess. I hope this will help you and everyone who will read this answer.