metaclass error

A

asteele

dear readers,

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 linux2Traceback (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
 
F

F. Petitjean

Le 17 Mar 2005 12:27:07 -0800, (e-mail address removed) a écrit :
dear readers,

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
# ManagerInterface is a module not a class !
# try
from ManagerInterface import ManagerInterface
class TestManager(ManagerInterface):
# you can also define __init__ method with a super call
 
M

Michele Simionato

F. Petitijean:
ManagerInterface is a module not a class !

Yes, but the error message could be improved (at least for the sake of
people
not knowing the internal working of Python). Do you care to fill a bug
report?

Michele Simionato
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top