On Sep 23, 6:48 pm, joep <[EMAIL PROTECTED]> wrote: > A possible solution would be in > > http://bazaar.launchpad.net/~pauli-virtanen/scipy/pydocweb/revision/386 > > It seems to be possible to be used in the same way when iter_modules > is not available. > The usage in ``_lookfor_generate_cache`` in lib/utils.py looks almost > exactly the same > as in the above revision > > Josef
this works for me and leaves the module unchanged if iter_modules is available python 2.4 compatible version is copied from http://bazaar.launchpad.net/~pauli-virtanen/scipy/pydocweb/revision/386 with adjustment for variable names, and it works under python 2.4 windowsXP in Python24\Lib\site-packages\numpy\lib\utils.py def _lookfor_generate_cache starting at line 685 # import sub-packages if import_modules and hasattr(item, '__path__'): if hasattr(pkgutil,'iter_modules'): # line added for m in pkgutil.iter_modules(item.__path__): if _all is not None and m[1] not in _all: continue try: __import__("%s.%s" % (name, m[1])) except ImportError: continue else: # else branch added for pth in item.__path__: for mod_path in os.listdir(pth): init_py = os.path.join(pth, mod_path, '__init__.py') if not os.path.isfile(init_py): continue nm = "%s.%s" % (name, mod_path) try: __import__(nm) except: print >> sys.stderr, "Failed to import module %s" % nm pass example: C:\Josef\easyeclipseworkspace\sandbox\playground\numpyscipy \teststats>ipython Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: import numpy as np In [2]: np.lookfor('norm') Search results for 'norm' ------------------------- numpy.frexp y1,y2 = frexp(x) numpy.linalg.norm Matrix or vector norm. numpy.ma.cov Estimates the covariance matrix. numpy.random.normal Draw random samples from a normal (Gaussian) distribution. numpy.linalg.qr Compute QR decomposition of a matrix. ....... In [14]: np.version.version Out[14]: '1.2.0rc2' also tested with IDLE same result as with Python 2.5 Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** IDLE 1.2.2 ==== No Subprocess ==== >>> import numpy as np >>> np.version.version '1.2.0rc2' >>> np.lookfor('norm') Search results for 'norm' ------------------------- numpy.frexp y1,y2 = frexp(x) numpy.linalg.norm Matrix or vector norm. numpy.ma.cov Estimates the covariance matrix. numpy.random.normal Draw random samples from a normal (Gaussian) distribution. numpy.linalg.qr Compute QR decomposition of a matrix. are there any tests for lookfor? Josef _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion