Suggestion for improved ImportError message
Wojtek Walczak
gminick at nie.ma.takiego.adresu.w.sieci.pl
Wed Aug 13 18:15:48 EDT 2008
Dnia Wed, 13 Aug 2008 20:55:38 +0000 (UTC), Kent Tenney napisa³(a):
> from image import annotate
>
> ImportError: cannot import name annotate
>
> I found the problem via
>
> import image
> print image.__file__
>
> which made it clear that the wrong image module had been found.
>
> It would be nice if ImportError announced this up front.
Then go for it :-) You can prepare a patch and ask on python-dev
if the developers are interested.
I was never hacking the import things on C level before,
but a hint: you have to modify import_from function from
Python/ceval.c
My quick attempt:
http://www.stud.umk.pl/~wojtekwa/patches/from-import-py2.5.1.patch
--
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/
More information about the Python-list
mailing list