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 FFY00
Recipients FFY00, pablogsal
Date 2021-07-23.00:51:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627001479.9.0.177247321024.issue44717@roundup.psfhosted.org>
In-reply-to
Content
Consider the following


$ tree a
a
├── b
│   ├── c.py
│   └── __init__.py
└── __init__.py

1 directory, 3 files
$ cat a/b/__init__.py
import a.b.c
$ cat a/b/c.py
import a.b

a.b
$ python
Python 3.9.6 (default, Jun 30 2021, 10:22:16)
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import a.b
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/anubis/test/a/b/__init__.py", line 1, in <module>
    import a.b.c
  File "/home/anubis/test/a/b/c.py", line 3, in <module>
    a.b
AttributeError: module 'a' has no attribute 'b'


This happens because even though the module `a` is initialized, the `b` attribute is not set due to the circular import. When a module is partially initialized, we get a more helpful error description hinting that we cannot access the attribute because the module is partially initialized, we could have something similar here.
History
Date User Action Args
2021-07-23 00:51:19FFY00setrecipients: + FFY00, pablogsal
2021-07-23 00:51:19FFY00setmessageid: <1627001479.9.0.177247321024.issue44717@roundup.psfhosted.org>
2021-07-23 00:51:19FFY00linkissue44717 messages
2021-07-23 00:51:19FFY00create