0

Working with this package - https://pypi.python.org/pypi/python-chess

In cmd I can do the following

>import chess
>b = chess.Board()
>print (b)

r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R

I then created a file called a.py, and it had these 3 lines:

import chess

b = chess.Board()

and I get:

Traceback (most recent call last): File "a.py", line 3, in board = chess.Board() AttributeError: module 'chess' has no attribute 'Board'

This came out of nowhere (yesterday, never had this issue) and is now an issue on both machines I tried with clean installs of python 3.5. HOW DO I FIX THIS?

1 Answers1

0

Do you have another file in the same directory as a.py with the name chess.py?

You can check the attributes of the chess module with

print(dir(chess))

Or maybe you are running different python vesions?

pip show python-chess
pip3 show python-chess
salomonderossi
  • 2,180
  • 14
  • 20