[Numpy-discussion] python 2.4 incompatibility in numpy.lookfor in numpy 1.2.0rc2

joep josef.pktd@gmail....
Tue Sep 23 15:18:40 CDT 2008

I was trying to use lookfor on python 2.4 and got an exception with
np.lookfor because of a missing method in pkgutil that was added in
python 2.5.

see the following session

>>> np.lookfor('range')
Traceback (most recent call last):
  File "<pyshell#55>", line 1, in ?
  File "C:\Programs\Python24\Lib\site-packages\numpy\lib\utils.py",
line 556, in lookfor
    cache = _lookfor_generate_cache(module, import_modules,
  File "C:\Programs\Python24\Lib\site-packages\numpy\lib\utils.py",
line 687, in _lookfor_generate_cache
    for m in pkgutil.iter_modules(item.__path__):
AttributeError: 'module' object has no attribute 'iter_modules'

>>> import pkgutil
>>> dir(pkgutil)
['__builtins__', '__doc__', '__file__', '__name__', 'extend_path',
'os', 'sys']
>>> pkgutil.__file__
>>> np.version.version


More information about the Numpy-discussion mailing list