[Python-Dev] ImportWarning flood

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jun 22 10:26:15 CEST 2006


--- "Martin v. Löwis" <martin at v.loewis.de> wrote:

> 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.)

> 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.

In our applications we typically address this type of problem with informative
exceptions. For example, if a Boost.Python wrapped C++ object doesn't support
pickling:

  RuntimeError: Pickling of "cctbx_sgtbx_ext.space_group_symbols" instances is
not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html)

Something like this could help newcomers just the same without impacting
experienced users with large, complex package structures. E.g.:

>>> import mypackage.foo
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: No module named mypackage.foo
    Note that subdirectories are searched for imports only if they contain an
    __init__.py file: http://www.python.org/doc/essays/packages.html


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Python-Dev mailing list