On Aug 11, 2:41 pm, Johannes Bauer <[EMAIL PROTECTED]> wrote:
> 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"

mastergen is a module, so you can't subclass it.  Try changing the
import line to:

from GenerationScripts.mastergen import mastergen


BTW, the error message is misleading, and it seems like it'd be a
common error.  Maybe it deserves a special case error message.  (I.e.
if the call to metaclass.__init__ raises TypeError, check to see if
it's a module and raise a better error message.)


Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to