Iterating package's module list
ischenko at gmail.com
ischenko at gmail.com
Tue May 10 12:34:33 EDT 2005
Hi,
I'm trying to find all modules that contain doctests and execute them
(using DocTestSuite). The problem is how to iterate (programmatically)
through the package's modules.
>>> import M
>>> inspect.getmembers(M, inspect.ismodule)
[]
Iterating through the source files (via glob) does not help either:
>>> __import__('M.foobar')
<module 'M' from 'M\__init__.pyc'>
See, individual modules points to the base package, not to the module
itself.
How can I iterate through the modules that comprise a Python package?
More information about the Python-list
mailing list