[Python-Dev] ImportWarning flood

Guido van Rossum guido at python.org
Fri Jun 30 21:51:34 CEST 2006

On 6/30/06, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Sun, 25 Jun 2006 17:51:17 -0700, Guido van Rossum <guido at python.org> wrote:
> >On 6/24/06, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> >> >Actually, your application *was* pretty close to being broken a few
> >> >weeks ago, when Guido wanted to drop the requirement that a package
> >> >must contain an __init__ file. In that case, "import math" would have
> >> >imported the directory, and given you an empty package.
> >>
> >>But this change was *not* made, and afaict it is not going to be made.
> >
> >Correct. We'll stick with the warning. (At least until Py3k but most
> >likely also in Py3k.)
> >
> Even given that it emits completely spurious warnings for any package that
> happens to share a name with a directory in whatever the working path is
> (say, your home directory)?
> How about if someone grovels through import.c and figures out how to make
> the warning information only show up if the import actually fails?

That would work I think. But it's not easy.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list