Re: problems with inheritance

[email protected] Tue, 17 Aug 2004 23:08:55 +0200
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>


  I think that the pb. here is that the root package, named
after the model's package nale (here: 'Person' AFAIK) isn't
in the python path.

  Could you check whether you get the same error with
/home/lgs/proyectos/pruebas-modeling/
in your PYTHONPATH (before '.', in case you have in the py-path),
and report back?  Thanks.

(I can't check it here right now, despite the fact that you
 send us the whole code, sorry).

-- Sébastien.


Lorenzo Gil Sanchez wrote:
> 
> I have a pymodel written in a file and after creating the 
> database and the python classes (mdl_generate_DB_schema.py 
> and mdl_generate_python_code -B) I try to run some basic code 
> and I get this
> exception:
> 
> Traceback (most recent call last):
>   File "model_person.py", line 33, in ?
>     from Person.Customer import Customer
>   File 
> "/home/lgs/proyectos/pruebas-modeling/Person/Customer.py", 
> line 2, in ?
>     from MDL.Customer import Customer as MDL_Customer_Customer
>   File "/home/lgs/proyectos/pruebas-modeling/Person/MDL/Customer.py",
> line 5, in ?
>     from Person.Person import Person
> ImportError: No module named Person
> 
> It looks like the problem arises when using Inheritance. In 
> my model, the Customer entity inherits from the Person 
> entity. The python code generated by modeling tryies to 
> import Person when defining Customer and it can't find it.
> 
> I think a possible solution would be to modify the 
> __init__.py file of the package modeling is generating so it 
> imports all the domain classes generated.
> 
[sample code snipped]



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285