[Python-Dev] ImportWarning flood

A.M. Kuchling amk at amk.ca
Thu Jun 22 14:24:01 CEST 2006


On Wed, Jun 21, 2006 at 10:34:53PM -0700, Ralf W. Grosse-Kunstleve wrote:
> But this doesn't:
> python -W'ignore:Not importing directory:ImportWarning'

This is a bug.  I've filed bug #1510580 and assigned it to Brett.  I
think the problem was exposed by the new-style exception change, but
the actual bug is in warnings.py; the check for a legal category is
wrong.

> Also, the magic incantation to silence the warnings would be very helpful here:

Good idea; I'll add it.

You could add the following to your site.py or your .pythonrc.py:

warnings.filterwarnings('ignore', 'Not importing directory', ImportWarning)

--amk


More information about the Python-Dev mailing list