Can't instantiate abstract class with abstract methods

asked10 years ago
last updated3 years ago
viewed132.5k times
Up Vote56Down Vote

I'm working on a kind of lib, and I'm getting an error.

I went on the basis that the code below works.

test.py:

import abc
import six

@six.add_metaclass(abc.ABCMeta)
class Base(object):

    @abc.abstractmethod
    def whatever(self,):
        raise NotImplementedError

class SubClass(Base):

    def __init__(self,):
    
        super(Base, self).__init__()
        self.whatever()

    def whatever(self,):
        print("whatever")

In the python shell:

>>> from test import *
>>> s = SubClass()
whatever

For my module, why am I getting this error:

Can't instantiate abstract class Player with abstract methods _Base__json_builder, _Base__xml_builder