New submission from Torsten Landschoff <t.landsch...@gmx.net>: I ran into an ImportError I was unable to explain:
$ python -c "import a.b" Traceback (most recent call last): File "<string>", line 1, in <module> File "a/b/__init__.py", line 1, in <module> import a.b.c File "a/b/c.py", line 2, in <module> import a.b.t as t AttributeError: 'module' object has no attribute 'b' This is the source code: $ tail `find -name \*.py` ==> ./demo.py <== import a.b ==> ./a/__init__.py <== ==> ./a/b/c.py <== # Does not work: import a.b.t as t # Works: # import a.b # from a.b import t ==> ./a/b/t.py <== ==> ./a/b/__init__.py <== import a.b.c # Works: # import a.b.t Replacing any import with one of the versions annotated as working fixes it. Stripping another level from the package tree fixes it as well. Why!? ---------- components: Interpreter Core files: import_error.tar.gz messages: 103091 nosy: torsten severity: normal status: open title: Incomprehensibly import error versions: Python 2.6 Added file: http://bugs.python.org/file16915/import_error.tar.gz _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8389> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com