Newbie packages Q

MarkyMarc marcsgbrevkonto at gmail.com
Sun Oct 7 07:10:40 EDT 2007


Hi All,

I do not understand the packages system in python. I have read this
http://docs.python.org/tut/node8.html a 100 times and I can not get it
to work.

I make a test app like this:
*******************************
Test/
      __init__.py (a empty file)
      apack/
               __init__.py (a empty file)
               atest.py
      bpack/
               __init__.py (a empty file)
               btest.py
*******************************
atest.py:
from Test.bpack import btest

def printA():
	print "This is Atest from Apack"

def printbtest():
	print btest.printB()

print printA()
print printbtest()
*******************************
btest.py:
from Test.apack import atest

def printB():
	print "This is Btest from Bpack"

def printatest():
	print atest.printA()

print printatest()
*******************************

All I get is an import error: ImportError: cannot import name x

I can remove the import statements an use the Test package quit normal
but when I try to make intra-pacage references I get the import error.

I must be missing something, could any one point me at what.

Thank you.




More information about the Python-list mailing list