[Python-Dev] ImportWarning flood

"Martin v. Löwis" martin at v.loewis.de
Fri Jun 23 22:20:15 CEST 2006


Ralf W. Grosse-Kunstleve wrote:
>>> Is there a way to set the warning options via an environment variable?
>> This is off-topic for python-dev,
> 
> What is the channel I should use? (I am testing a beta 1.)

The specific question was

"Is there a way to set the warning options via an environment variable?"

This has nothing to do with beta1; the warnings module was introduced
many releases ago, along with all the mechanics to disable warnings.

>> but: why don't switch off the warnings
>> in the code?
> 
> We support installation from sources with the native Python if available. Any
> Python >= 2.2.1 works. It would be frustrating if we had to give up on this
> just because of a warning designed for newcomers.

I guess you misunderstood. I propose you put warnings.simplefilter()
into your code. The warnings was introduced before 2.2.1 IIRC, so this
should work on all releases you want to support (but have no effect on
installations where the warning isn't generated).

Regards,
Martin


More information about the Python-Dev mailing list