[Python-Dev] ImportWarning flood

Michael Hudson mwh at python.net
Mon Jun 26 12:51:51 CEST 2006

James Y Knight <foom at fuhm.net> writes:

> On Jun 24, 2006, at 1:29 PM, Ralf W. Grosse-Kunstleve wrote:
>> --- Jean-Paul Calderone <exarkun at divmod.com> wrote:
>>> I think it is safe to say that Twisted is more widely used than  
>>> anything
>>> Google has yet released.  Twisted also has a reasonably plausible
>>> technical reason to dislike this change.  Google has a bunch of  
>>> engineers
>>> who, apparently, cannot remember to create an empty __init__.py  
>>> file in
>>> some directories sometimes.
>> Simply adding a note to the ImportError message would solve this  
>> problem "just
>> in time":
>>>>> import mypackage.foo
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>> ImportError: No module named mypackage.foo
>>     Note that subdirectories are searched for imports only if they  
>> contain an
>>     __init__.py file: http://www.python.org/doc/essays/packages.html
> I also dislike the warning solution. Making the ImportError message  
> more verbose seems like a much nicer solution.

Me too. 

ImportError: no module named foo 
   Note: directory foo/ with no __init__.py not imported

would be nice, but I don't know how hard it would be to achieve.  I'm
scared of the import.c.


  While preceding your entrance with a grenade is a good tactic in
  Quake, it can lead to problems if attempted at work.    -- C Hacking
               -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html

More information about the Python-Dev mailing list