issue on internal import in a package

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


On Feb 27, 8:11 pm, 人言落日是天涯,望极天涯不见家 <kelvin.... at gmail.com> wrote:
> 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?

PS. This issue occurred on Python3.2
It's okay in the Python2.6 & Python2.5



More information about the Python-list mailing list