issue on internal import in a package

人言落日是天涯,望极天涯不见家 kelvin.you at gmail.com
Sun Feb 27 07:11:57 EST 2011


Here is a simple example:
[app]
      [module]
            __init__.py   --> empty
            a.py   --> import b
            b.py  --> defined a function foo()
      test.py

In the test.py, contains the below statement:
from module import a
Execute the test.py will get error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "module\a.py", line 1, in <module>
    import b
ImportError: No module named b

Why the b.py can not be found by a.py?



More information about the Python-list mailing list