relative import broken?

test juice at lemonacid.com
Wed Apr 30 09:41:26 EDT 2008


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.





More information about the Python-list mailing list