[SciPy-user] help and lazy importer (again or still ?)

Pearu Peterson pearu at scipy.org
Wed May 5 14:44:54 CDT 2004



On Wed, 5 May 2004, Arnd Baecker wrote:

> with yesterdays CVS version I came across the
> following problem
> 
> >>> help ("scipy.integrate.odeint")
>    [[ this works fine ]]
> >>> from  scipy.integrate import odeint
> >>> help ("scipy.integrate.odeint")
<snip>
> ImportError: No module named odeint

> 
> Our students stumbled across this and complained
> "There is no help for scipy.integrate.odeint" ;-).
> 
> I hope that there is an easy solution to this
> (and that my question does not open a can of worms ... ;-)

Luckily;-), it wasn't a bug but an overlooked case (I believe it was 
the last one). The corresponding support code is commited to CVS now.

> And there is another (related?) one:
> 
> Python 2.3.3 (#1, May  3 2004, 16:38:25)
> [GCC 3.3.3 (Debian)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> help("scipy.linalg")
> Gives
>   Help on instance of _ModuleLoader in scipy:
>   scipy.linalg = <module 'scipy.linalg' from '/home/python/PYTHON...
>     e-packages/scipy/linalg/__init__.pyc' [imported]>
> 
> Only on the second call to help("scipy.linalg")
> one gets the expected documentation.

Unfortunately, the only way to avoid the above issue is to import 
scipy_base or scipy (that imports ppimport module which adds a hook to 
pydoc.help to handle postponed modules) before trying to get help of scipy
objects. You can import scipy_base in $PYTHONSTARTUP script, for instance.

Regards,
Pearu



More information about the SciPy-user mailing list