I also have a problem with relative import; I can't for the life of me figure out how to use the damn thing. I think the main problem is with getting Python to recognize the existence of a package. I have
S/ p.py B/ b.py W/ pyw/ u.py ws.py and I'd like to get u.py to import all the other 3 programs. I put empty __init__.py files in all of the above directories (is this necessary?), and even manually added the pathway (r'C:\Myname\S') to sys.path, but when I execute from S import p in u.py Python gives "ImportError: No module named S". It says "No module named X" for essentially any package reference, so I think it's just not recognizing the directories as packages. The docs for relative import make this sound much easier than it is. Thanks in advance, I'm at my wit's end. -Sam On Apr 30, 9:41 am, "test" <[EMAIL PROTECTED]> wrote: > basic noob question here. > > i am trying to reference a package, i have the structure: > > mypack/ > __init__.py > test.py > subdir1/ > __init__.py > mod1.py > subdir2/ > __init__.py > mod2.py > > can someone please tell me why the statement: > > from mypack.subdir1.mod1 import * > > does NOT work from mod2.py nor from test.py? > > instead, if i use: > > from subdir1.mod1 import * > > it works perfectly from test.py. > > ....? > > thank you, > > aj. -- http://mail.python.org/mailman/listinfo/python-list