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.

Title: relative imports don't work when circular
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.2, Python 3.3
Status: closed Resolution: duplicate
Dependencies: Superseder: attribute error due to circular import
View: 992389
Assigned To: Nosy List: brett.cannon, eric.snow, flox, meador.inge, ncoghlan, pitrou
Priority: normal Keywords:

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) * (Python committer) Date: 2011-10-15 20:28
This is, to say the least, annoying.

$ mkdir mypackage
$ touch mypackage/
$ echo "from . import b" > mypackage/
$ echo "from . import a" > mypackage/
$ ./python -c "import mypackage.a"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "mypackage/", line 1, in <module>
    from . import b
  File "mypackage/", line 1, in <module>
    from . import a
ImportError: cannot import name a
msg145613 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) 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
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57396
2011-10-16 06:44:55ncoghlansetstatus: open -> closed
resolution: duplicate
superseder: attribute error due to circular import
messages: + msg145613
2011-10-15 22:20:47meador.ingesetnosy: + meador.inge
2011-10-15 20:58:30eric.snowsetnosy: + eric.snow
2011-10-15 20:32:15floxsetnosy: + flox
2011-10-15 20:30:54pitrousetnosy: + brett.cannon
2011-10-15 20:28:44pitroucreate