[Python-Dev] ImportError message suggestion (original) (raw)
Kent Tenney ktenney at gmail.com
Tue Aug 19 15:53:59 CEST 2008
- Previous message: [Python-Dev] Hanging out on freenode IRC #python-dev
- Next message: [Python-Dev] ImportError message suggestion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Howdy,
I brought this up on c.l.p., was encouraged to try it here.
http://groups.google.com/group/comp.lang.python/browse_thread/thread/88474a32877026fc/
from image import annotate ImportError: cannot import name annotate
I found the problem via
import image print image.file
which told me the wrong image module had been found.
It would be nice if ImportError announced this up front:
ImportError: cannot import name annotate from /usr//image.pyc
I got a bit of encouragement, and a patch from Wojtek Walczak http://www.stud.umk.pl/~wojtekwa/patches/from-import-py2.5.1.patch
a bit more encouragement: "I think the acceptance for this wouldn't be that hard since there is no real issue for regression (the only one I could think of is for doctest module, although I'm not sure there are any reason to test for failed import in doctest)"
and a caveat: "I have code that uses numpy if available, otherwise uses slower normal Python code. Inside the doctests I'd like to test both situations..."
I can't write the C code myself, or evaluate the patch.
I think this change might save some other poor schlub the time I've spent fussing with this issue.
Thanks, Kent
- Previous message: [Python-Dev] Hanging out on freenode IRC #python-dev
- Next message: [Python-Dev] ImportError message suggestion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]