[SciPy-User] List Scipy submodules programatically

Robert Kern robert.kern@gmail....
Sun Jan 8 05:15:12 CST 2012


On Sun, Jan 8, 2012 at 11:07, klo uo <klonuo@gmail.com> wrote:
> I first tried with dir(scipy), then by using help from python modules pyclbr
> and inspect, but I just can't find how to get this sub-packages listed
> programatically from within script
>
> I mean about this:
> http://docs.scipy.org/doc/scipy/reference/tutorial/general.html#scipy-organization
>
> What I'm missing?

scipy/__init__.py does not import the subpackages itself; it's too
expensive to import all of them every time. So dir(scipy) won't work
nor will anything else that is depending on the modules to already be
imported. You need to find the directory containing scipy/__init__.py
[os.path.dirname(scipy.__file__)] and then look in that directory for
subdirectories with __init__.py files in them.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-User mailing list