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: A more informative message for ImportError
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 3.1, Python 2.7
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.

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

a patch from Wojtek Walczak is here and attached

a thread about it on python-dev is here

including a comment on the patch
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.
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