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: A more informative message for ImportError
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.1, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, ktenney
Priority: low Keywords: patch

Created on 2008-08-20 14:00 by ktenney, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
from-import-py2.5.1.patch ktenney, 2008-08-20 14:00 patch to ceval.c from Wojtek Walczak Re: ImportError
Messages (2)
msg71542 - (view) Author: Kent Tenney (ktenney) Date: 2008-08-20 14:00
from foo import bar
ImportError: cannot import name bar

The error may be due to the wrong 'foo' being found, some investigation
is required.

If the the ImportError message included the filename for 'foo', the
problem would be obvious.
ImportError cannot import name bar from  /usr/lib/<snip>/foo.pyc

A c.l.p. thread on this is at
http://groups.google.com/group/comp.lang.python/browse_thread/thread/88474a32877026fc/

a patch from Wojtek Walczak is here and attached
http://www.stud.umk.pl/~wojtekwa/patches/from-import-py2.5.1.patch

a thread about it on python-dev is here
http://mail.python.org/pipermail/python-dev/2008-August/081889.html

including a comment on the patch
http://mail.python.org/pipermail/python-dev/2008-August/081897.html
msg85167 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2009-04-02 05:35
Closing as "won't fix" as this assumes that path information is
applicable to all importers which is not correct.
History
Date User Action Args
2022-04-11 14:56:37adminsetgithub: 47869
2009-04-02 05:35:25brett.cannonsetstatus: open -> closed
resolution: wont fix
messages: + msg85167
2009-02-11 04:53:31ajaksu2setassignee: brett.cannon
nosy: + brett.cannon
2008-08-20 14:05:34benjamin.petersonsetpriority: low
components: + Interpreter Core, - None
versions: + Python 3.1
2008-08-20 14:00:34ktenneycreate