Suggestion for improved ImportError message

Wojtek Walczak gminick at nie.ma.takiego.adresu.w.sieci.pl
Wed Aug 13 18:39:58 EDT 2008


Dnia Wed, 13 Aug 2008 22:15:48 +0000 (UTC), Wojtek Walczak napisa³(a):

> 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

Uh, and an example:

Python 2.5.1 (r251:54863, Aug 14 2008, 00:04:00)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from os import qweasd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name qweasd (/home/gminick/Python-2.5.1/Lib/os.pyc)
>>>

-- 
Regards,
Wojtek Walczak,
http://www.stud.umk.pl/~wojtekwa/



More information about the Python-list mailing list