Hallöchen!

Assume the follwing package structure:

main.py
package/
    __init__.py   [empty]
    moduleX.py
    moduleY.py

main.py says:

    from package import moduleX

moduleX.py says:

    from . import moduleY

and moduleY.py says:

    from . import moduleX

However, this doesn't work:

    [EMAIL PROTECTED]:~/temp/packages-test$ python main.py
    Traceback (most recent call last):
      File "main.py", line 1, in <module>
        from package import moduleX
      File "/home/bronger/temp/packages-test/package/moduleX.py", line 1, in 
<module>
        from . import moduleY
      File "/home/bronger/temp/packages-test/package/moduleY.py", line 1, in 
<module>
        from . import moduleX
    ImportError: cannot import name moduleX

If I turn the relative imports to absolute ones, it works.  But I'd
prefer the relative notation for intra-package imports.  Why is this
restriction?

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: [EMAIL PROTECTED]
               (See http://ime.webhop.org for further contact info.)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to