Package question
Delaney, Timothy
tdelaney at avaya.com
Mon Sep 25 19:44:21 EDT 2000
You need an __init__.py in each package ...
myprogram.py
MainPackage\
__init__.py
a.py
SubPackage1\
__init__.py
b.py
SubPackage2\
__init__.py
c.py
> Bernhard Herzog wrote:
> >
> > Hans Nowak <ivnowa at hvision.nl> writes:
> >
> > > myprogram.py
> > > MainPackage\
> > > a.py
> > > SubPackage1\
> > > b.py
> > > SubPackage2\
> > > c.py
> > >
> > > In such cases, b.py cannot find a.py and thus it cannot use any
> > > general modules in MainPackage. Neither can it see c.py in
> > > SubPackage2.
> >
> > Just use
> >
> > import MainPackage.a
> >
> > and
> > import MainPackage.SubPackage2.b
>
> Yes, but that is exactly the problem... b.py cannot see MainPackage
> either. Unless
> I add it to sys.path, which I *don't* want to do. =(
> --
> http://www.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list