Inheritance crossover packages

Johannes Bauer dfnsonfsduifb at gmx.de
Mon Aug 11 14:41:01 EDT 2008


Hello group,

I'm having a seemingly simple problem. I want to generate a hierarchy of 
modules, like this one:

GenerationScripts/
GenerationScripts/dhcp
GenerationScripts/bind9

And the files:

GenerationScripts/dhcp/__init__.py
GenerationScripts/bind9/generator.py
GenerationScripts/bind9/__init__.py
GenerationScripts/mastergen.py
GenerationScripts/__init__.py

All packages (bind9, dhcp) should inherit from the master generator 
"mastergen".

I'm at the very beginning:

$ cat GenerationScripts/__init__.py
import bind9
#import dhcpd

$ cat GenerationScripts/bind9/__init__.py
import GenerationScripts.bind9.generator

$ cat GenerationScripts/bind9/generator.py
from GenerationScripts import mastergen

class generator(mastergen):
	def __init__(self):
		print "init bind9 generator"

Now what happens when I import GenerationScripts and try to create a 
instance of GenerationScripts.bind9.generator is the following:

Traceback (most recent call last):
   File "./Generate.py", line 3, in <module>
     import GenerationScripts
   File "/home/joe/x/GenerationScripts/__init__.py", line 3, in <module>
     import bind9
   File "/home/joe/x/GenerationScripts/bind9/__init__.py", line 4, in 
<module>
     import GenerationScripts.bind9.generator
   File "/home/joe/x/GenerationScripts/bind9/generator.py", line 7, in 
<module>
     class generator(mastergen):
TypeError: Error when calling the metaclass bases
     module.__init__() takes at most 2 arguments (3 given)

I really don't get it - and I've searched and found the same problem, 
read the descirption - but still don't get it. What's happening here?

Regards,
Johannes

-- 
"Wer etwas kritisiert muss es noch lange nicht selber besser können. Es
reicht zu wissen, daß andere es besser können und andere es auch
besser machen um einen Vergleich zu bringen."     -     Wolfgang Gerber
       in de.sci.electronics <47fa8447$0$11545$9b622d9e at news.freenet.de>



More information about the Python-list mailing list