[Python-Dev] ImportWarning flood (original) (raw)
Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Sat Jun 24 08:58:46 CEST 2006
- Previous message: [Python-Dev] ImportWarning flood
- Next message: [Python-Dev] ImportWarning flood
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
--- "Martin v. L�wis" <martin at v.loewis.de> wrote:
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.
Due to the new ImportWarning first introduced in 2.5b1 the question of disabling warnings is becoming much more pressing (I am assuming that I am not again the only person on the planet to have this problem).
I guess you misunderstood.
Yes.
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).
Where would I put the warnings.simplefilter()? I have hundreds of scripts and init.py files.
I just came accross this situation (simplified):
% cd boost/boost % python2.5
import math main:1: ImportWarning: Not importing directory 'math': missing init.py
This is because there is a subdirectory math in boost/boost, something that I cannot change. The PYTHONPATH is not set at all in this case. I.e. I get the ImportWarning just because my current working directory happens to contain a subdirectory which matches one of the Python modules in the standard library. Isn't this going to cause widespread problems?
Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
- Previous message: [Python-Dev] ImportWarning flood
- Next message: [Python-Dev] ImportWarning flood
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]