I am trying to implement an abstract class in python (actually in a django application) and I am running against this madness:
>python concreteChildClass.py Traceback (most recent call last): File"concreteChildClass.py, line 1, in <module> from abc_base import AbstractBaseClass ImportError: No module named abc_base
I knocked down my problem with these files that reproduce the error in my env:
abstractBaseClass.py
import abc class abstractBaseClass(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def load(self, input): """Retrieve data from the input source and return an object.""" return
concreteChildClass.py
from abc_base import AbstractBaseClass class ConcreteChildClass(object): def load(self, input): return input.read()
Here is my python version information
>>> import sys >>> print sys.version 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2]
I am new to python (as this question may make it painfully obvious), but I cannot figure out how to find "abc", but not "abc_base". My reading and google search did not give me answers to this question. Thanks in advance and apologize if this is a stupid question.
source share