Message398021
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. |
|
| Date |
User |
Action |
Args |
| 2021-07-23 00:51:19 | FFY00 | set | recipients:
+ FFY00, pablogsal |
| 2021-07-23 00:51:19 | FFY00 | set | messageid: <1627001479.9.0.177247321024.issue44717@roundup.psfhosted.org> |
| 2021-07-23 00:51:19 | FFY00 | link | issue44717 messages |
| 2021-07-23 00:51:19 | FFY00 | create | |
|