Re: [Modeling-users] problems with inheritance
Status: Abandoned
Brought to you by:
sbigaret
From: <seb...@nu...> - 2004-08-17 22:55:56
|
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] |