[Python-Dev] ImportWarning flood

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu Jun 22 02:58:23 CEST 2006


http://docs.python.org/dev/whatsnew/other-lang.html says:

> One error that Python programmers sometimes make is forgetting to 
> include an __init__.py module in a package directory. Debugging this
> mistake can be confusing, and usually requires running Python with the 
> -v switch to log all the paths searched. In Python 2.5, a new
> ImportWarning warning is raised when an import would have picked up a
> directory as a package but no __init__.py was found.

I am getting tons of "ImportWarning: Not importing directory". See below for
examples. It is impractical for me to reorganize our directory structure. I'd
be busy for a week or more and people would probably scream at me because all
the paths have changed. Are there other options to get rid of the warnings?

Thanks!

Ralf



/net/rosie/scratch1/rwgk/dist/libtbx/libtbx/command_line/scons.py:1:
ImportWarning: Not importing directory '/net/rosie/scratch1/rwgk/dist/libtbx':
missing __init__.py
  from libtbx.utils import Sorry
/net/rosie/scratch1/rwgk/py25b1/build/python/lib/python2.5/random.py:43:
ImportWarning: Not importing directory
'/net/rosie/scratch1/rwgk/dist/cctbx/math': missing __init__.py
  from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
/net/rosie/scratch1/rwgk/py25b1/build/python/lib/python2.5/random.py:43:
ImportWarning: Not importing directory
'/net/rosie/scratch1/rwgk/dist/scitbx/math': missing __init__.py
  from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
scons: Reading SConscript files ...
/net/rosie/scratch1/rwgk/dist/scons/src/engine/SCons/Tool/__init__.py:112:
ImportWarning: Not importing directory
'/net/rosie/scratch1/rwgk/dist/scons/src/engine/SCons/Tool/CVS': missing
__init__.py
  file, path, desc = imp.find_module(self.name, smpath)


/net/rosie/scratch1/rwgk/dist/phenix/phenix/__init__.py:1: ImportWarning: Not
importing directory '/net/rosie/scratch1/rwgk/dist/libtbx': missing __init__.py
  try: import libtbx.forward_compatibility
/net/rosie/scratch1/rwgk/dist/phenix/phenix/refinement/__init__.py:1:
ImportWarning: Not importing directory '/net/rosie/scratch1/rwgk/dist/iotbx':
missing __init__.py
  import iotbx.phil
/net/rosie/scratch1/rwgk/dist/iotbx/iotbx/phil.py:1: ImportWarning: Not
importing directory '/net/rosie/scratch1/rwgk/dist/cctbx': missing __init__.py
  from cctbx import sgtbx
/net/rosie/scratch1/rwgk/dist/cctbx/cctbx/array_family/flex.py:1:
ImportWarning: Not importing directory '/net/rosie/scratch1/rwgk/dist/scitbx':
missing __init__.py
  import scitbx.array_family.flex
/net/rosie/scratch1/rwgk/dist/scitbx/scitbx/array_family/flex.py:2:
ImportWarning: Not importing directory '/net/rosie/scratch1/rwgk/dist/boost':
missing __init__.py
  import boost.optional
/net/rosie/scratch1/rwgk/dist/libtbx/libtbx/utils.py:226: ImportWarning: Not
importing directory '/net/rosie/scratch1/rwgk/dist/mmtbx': missing __init__.py
  try: module = __import__(module_path)

etc. etc.


__________________________________________________
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