Issue 13187: relative imports don't work when circular
Created on 2011-10-15 20:28 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg145606 - (view) | Author: Antoine Pitrou (pitrou) * ![]() |
Date: 2011-10-15 20:28 | |
This is, to say the least, annoying.
$ mkdir mypackage
$ touch mypackage/__init__.py
$ echo "from . import b" > mypackage/a.py
$ echo "from . import a" > mypackage/b.py
$ ./python -c "import mypackage.a"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "mypackage/a.py", line 1, in <module>
from . import b
File "mypackage/b.py", line 1, in <module>
from . import a
ImportError: cannot import name a
|
|||
| msg145613 - (view) | Author: Alyssa Coghlan (ncoghlan) * ![]() |
Date: 2011-10-16 06:44 | |
This is the same problem that all "from x import y" circular imports have - it isn't specific to relative imports. Closing as a duplicate of issue 992389 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:22 | admin | set | github: 57396 |
| 2011-10-16 06:44:55 | ncoghlan | set | status: open -> closed resolution: duplicate superseder: attribute error due to circular import messages: + msg145613 |
| 2011-10-15 22:20:47 | meador.inge | set | nosy:
+ meador.inge |
| 2011-10-15 20:58:30 | eric.snow | set | nosy:
+ eric.snow |
| 2011-10-15 20:32:15 | flox | set | nosy:
+ flox |
| 2011-10-15 20:30:54 | pitrou | set | nosy:
+ brett.cannon |
| 2011-10-15 20:28:44 | pitrou | create | |
