Is "python -W ignore" the default?

rihad rihad at mail.ru
Mon Sep 20 05:10:06 EDT 2010


$ mkdir foo
$ python
Python 2.7 (r27:82500, Sep  1 2010, 22:10:47)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__']
>>> import foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named foo
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__',
'__warningregistry__']
>>> __warningregistry__.items()
[(("Not importing directory 'foo': missing __init__.py", <type
'exceptions.ImportWarning'>, 1), True)]
>>>
$ (...went to read some "man python"...)
$ python -W default
Python 2.7 (r27:82500, Sep  1 2010, 22:10:47)
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd7
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo
__main__:1: ImportWarning: Not importing directory 'foo': missing
__init__.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named foo
>>>
$

The problem isn't easily spotted unless run with -W default. How come
"default" is not on by default? :)



More information about the Python-list mailing list