This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gangesmaster
Recipients gangesmaster
Date 2010-02-10.19:09:20
SpamBayes Score 0.0
Marked as misclassified No
Message-id <>
the relative-import mechanism is broken... at least on python2.6 but i'd guess on later versions as well.

consider this package layout:

where is:
    # note this is a relative import and should fail!
    from .os import walk
    print walk
    # and this should also fail
    from . import os
    print os

running it yields a bug:

$ PYTHONPATH="/tmp" python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import
<function walk at 0xb7d2aa04>  # <<<< ?!?!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/foo/", line 4, in <module>
    from . import os
ImportError: cannot import name os

"from . import os" fails as expected, but "from .os import walk" works -- although it should obviously fail too.

Date User Action Args
2010-02-10 19:09:23gangesmastersetrecipients: + gangesmaster
2010-02-10 19:09:23gangesmastersetmessageid: <>
2010-02-10 19:09:21gangesmasterlinkissue7902 messages
2010-02-10 19:09:20gangesmastercreate