James Hancock
asked on
Why is my Python abc setup giving errors?
Hi
My PyCharm is giving surprising red-underlining on import abc, object, and from abc import
Up til now, my chess engine has been working on a player class, but I'd like it to be an abstract base class. I am re-designing it
Must I do any special entries in the Project Settings panel? my code below doesn't seem to be a problem,
My abc is :
Thanks
My PyCharm is giving surprising red-underlining on import abc, object, and from abc import
Up til now, my chess engine has been working on a player class, but I'd like it to be an abstract base class. I am re-designing it
Must I do any special entries in the Project Settings panel? my code below doesn't seem to be a problem,
My abc is :
import abc
class ChessPlayer(object):
__metaclass__= abc.ABCMeta
@abc.abstractmethod
def get_white_move(self, white_moves):
"""white player chooses the best move for this turn"""
return
@abc.abstractmethod
def get_black_move(self, black_moves):
"""black player chooses the best move for this turn"""
return
My derivative class is:import abc
from abc_base import ChessPlayer:
class RandomPlayer(Object):
# ToBeDone, once setup is correct
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
I've done what you suggested, and there are some errors that I don't understand.
I did the name change for abc_base.py:
My RandomPlayer.py does appropriate implementations of the methods:
Open in new window
Why does the instantiation of a randomPlayer fail in the engine class? :
Open in new window
Thanks