homepage

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.

classification
Title: relative imports don't work when circular
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.2, Python 3.3
process
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/__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) * (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 
History
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

AltStyle によって変換されたページ (->オリジナル) /