Newbie packages Q

MarkyMarc marcsgbrevkonto at gmail.com
Sun Oct 7 17:59:11 CEST 2007


On Oct 7, 5:49 pm, Wildemar Wildenburger
<lasses_w... at klapptsowieso.net> wrote:
> MarkyMarc wrote:
> >  *******************************
> > atest.py:
>
> > def printA():
> >         print "This is Atest from Apack"
> > *******************************
> > btest.py:
> > from Test.apack import atest
>
> > def printB():
> >         print "This is Btest from Bpack"
>
> > def printatest():
> >         print atest.printA()
>
> > print printB()
> > print printatest()
> > *******************************
>
> > Now only one of them imports the other, and this most be the simplest
> > way of illustrating the intra-package references.
> > But how do I get this to work?
>
> This doesn't work? What error do you get?
> I've never done too complicated packaging stuff, and can't raelly
> testdrive your example right now. Maybe you have to look into sys.path
> if Test can be found at all. Or maybe you have to play with the import
> statement (from apack import atest?). I'm just guessing here; importing
> continues to remain going on being a mystery to me.
>
> /W

I get "no module name Test.apack."
But if I print the sys.path just before importing the Test.apack, I
have this:
/python/Test/bpack
So "Test" is in my path. But it seems like it will not look up the
path but only down. And there by do not read the __init__.py files.
But I might be wrong.

Anyone that can explain me how this import and packaging in python
works??




More information about the Python-list mailing list