Re: Finding a module's sub modules at runtime

2007-04-03 Thread Joshua J. Kugler
On Monday 02 April 2007 16:33, Robert Kern wrote: help(pkgutil.iter_modules) Help on function iter_modules in module pkgutil: iter_modules(path=None, prefix='') Yields (module_loader, name, ispkg) for all submodules on path, or, if path is None, all top-level modules on sys.path.

Re: Finding a module's sub modules at runtime

2007-04-02 Thread Joshua J. Kugler
On Thursday 29 March 2007 17:58, Alex Martelli wrote: Sure, pydoc (which help calls under the code) does that, with a nice mix of inspect, os, and pkgutil.iter_modules calls. pkgutil.iter_modules may in fact be most of what you need: help(pkgutil.iter_modules) Help on function iter_modules

Re: Finding a module's sub modules at runtime

2007-04-02 Thread Robert Kern
Joshua J. Kugler wrote: On Thursday 29 March 2007 17:58, Alex Martelli wrote: Sure, pydoc (which help calls under the code) does that, with a nice mix of inspect, os, and pkgutil.iter_modules calls. pkgutil.iter_modules may in fact be most of what you need: help(pkgutil.iter_modules) Help

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Alex Martelli
Joshua J. Kugler [EMAIL PROTECTED] wrote: still be nicely portable. It just seems that since Python is gathering that information anyway, it should make it available without me having to walk the directory tree. Sorry, where is Python gathering that information anyway? Unless I'm mistaken,

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Joshua J. Kugler
On Thursday 29 March 2007 07:33, Alex Martelli wrote: Joshua J. Kugler [EMAIL PROTECTED] wrote: still be nicely portable. It just seems that since Python is gathering that information anyway, it should make it available without me having to walk the directory tree. Sorry, where is

Re: Finding a module's sub modules at runtime

2007-03-29 Thread Alex Martelli
Joshua J. Kugler [EMAIL PROTECTED] wrote: On Thursday 29 March 2007 07:33, Alex Martelli wrote: Joshua J. Kugler [EMAIL PROTECTED] wrote: still be nicely portable. It just seems that since Python is gathering that information anyway, it should make it available without me having to

Finding a module's sub modules at runtime

2007-03-28 Thread Joshua J. Kugler
[If this is documented somewhere, please just point me there. I googled on the terms that made sense to me, and didn't find anything.] So, I have: ModTest __init__.py AModule.py BModule.py CModule.py All works fine. However, when I import ModTest, I would like

Re: Finding a module's sub modules at runtime

2007-03-28 Thread kyosohma
On Mar 28, 2:44 pm, Joshua J. Kugler [EMAIL PROTECTED] wrote: [If this is documented somewhere, please just point me there. I googled on the terms that made sense to me, and didn't find anything.] So, I have: ModTest __init__.py AModule.py BModule.py

Re: Finding a module's sub modules at runtime

2007-03-28 Thread Joshua J. Kugler
On Wednesday 28 March 2007 12:04, [EMAIL PROTECTED] wrote: All works fine. However, when I import ModTest, I would like it to discover and store the names of the modules beneath it, and construct a list, say mod_list, that I can access later to find the names of the sub-modules in this