metaclass error

Aaron Steele asteele at berkeley.edu
Thu Mar 17 15:45:15 EST 2005


hi,

i have a very simple package organized as follows:

!-----------------------------------------!
bgp/
    __init__.py
    managers/
            __init__.py
            ManagerInterface.py
            TestManager.py
!-----------------------------------------!

and here's ManagerInterface.py and TestManager.py:

!-----------------------------------------!
# ManagerInterface.py
class ManagerInterface(object):
    def __init__(self): pass
    def process(self, recset, operation):
        print 'In ManagerInterface.process()...'

# TestManager.py
import ManagerInterface
class TestManager(ManagerInterface):
    def process(self, recset, operation):
        print 'In TestManager.process()...' 
super(TestManager,self).process(recset,operation)
!-------------------------------------------!

when i try to import the TestManager module via the interpreter, i get 
the following error:

!-------------------------------------------!
$ python
Python 2.4.1c1 (#1, Mar 14 2005, 10:28:18)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-49)] on linux2
 >>> import bgp.managers.TestManager
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "bgp/managers/TestManager.py", line 2, in ?
    class TestManager(ManagerInterface):
TypeError: Error when calling the metaclass bases
    module.__init__() takes at most 2 arguments (3 given)
!-------------------------------------------!

any thoughts? i think that when python executes the TestManager class 
statement, it collects the base class (ManagerInterface) into a tuple 
and then executes the class body in a dictionary... is this where the 
error is happening?

thanks!
aaron




More information about the Python-list mailing list