[Python-Dev] ImportWarning flood

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Mon Jun 26 12:41:07 CEST 2006


--- "Martin v. L�wis" <martin at v.loewis.de> wrote:
> So spend some of the money to come up with an alternate solution for
> 2.5b2. With a potential damage of a million dollars, it shouldn't be
> too difficult to provide a patch by tomorrow, right?

My share is only 10 man hours, payed for by the US government at a scientist
salary. :-)

A simple patch with a start is attached. Example:

% ./python 
Python 2.5b1 (r25b1:47027, Jun 26 2006, 03:15:33) 
[GCC 4.1.0 20060304 (Red Hat 4.1.0-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named foo
  Note that subdirectories are searched for imports only if they contain an
  __init__.py file. See the section on "Packages" in the Python tutorial for
  details (http://www.python.org/doc/tut/).
>>> 


The "No module named" message is repeated in these files (2.5b1 tree):

./Demo/imputil/knee.py
./Lib/ihooks.py
./Lib/modulefinder.py
./Lib/xmlcore/etree/ElementTree.py
./Lib/runpy.py
./Lib/imputil.py

If there is a consenus, I'd create a new exception ImportErrorNoModule(name)
that is used consistently from all places. This would ensure uniformity of the
message in the future.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: import_patch
Type: application/octet-stream
Size: 1090 bytes
Desc: 467797280-import_patch
Url : http://mail.python.org/pipermail/python-dev/attachments/20060626/ce3bbfec/attachment.obj 


More information about the Python-Dev mailing list