[Tutor] Interpackage access help-Please disregard other post with same name
Francesco A. Queirolo
faq at lanl.gov
Mon Feb 13 18:01:16 CET 2006
Sorry about the double post but the first one was sent before I was
completed with my question.
I have the following directory structure on Windows XP running python
2.4.2 final:
JavaInheritancePoly\
HierarchicalInheritancePoly.py
Animals\
__init__.py
Modules\
__init__.py
Animal.py
Test\
__init__.py
AnimalTest.py
When in AnimalTest.py I would like to access animal. I have tried:
from JavaInheritancePoly.Animals.Modules import Animal
and receive this error from the interpreter window:
Traceback (most recent call last):
File "<stdin>", line 11, in ?
ImportError: No module named JavaInheritancePoly.Animals.Modules
Line 11 is of course the import statement.
I am able to access Animal.py from HierarchicalInheritancePoly.py through
either:
from Animals.Modules import Animal
OR
import Animals.Modules.Animal
I think it is some sort of problem with my path or sys.path but I am not
totally sure what is going on.
Thank you,
Francesco
--
Francesco Queirolo
Safeguards Systems Group(N-4)
Los Alamos National Laboratory
TA 35-2 A156
+1 505 606 1960
faq at lanl.gov
More information about the Tutor
mailing list