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

joep josef.pktd at gmail.com
Tue Sep 23 16:18:40 EDT 2008


Hi,
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 ?
    np.lookfor('range')
  File "C:\Programs\Python24\Lib\site-packages\numpy\lib\utils.py",
line 556, in lookfor
    cache = _lookfor_generate_cache(module, import_modules,
regenerate)
  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__
'C:\\Programs\\Python24\\lib\\pkgutil.pyc'
>>> np.version.version
'1.2.0rc2'

Josef



More information about the NumPy-Discussion mailing list