Loaded module list and attributes

Dale Strickland-Clark dale at riverhall.NOSPAMco.uk
Mon Jul 30 10:19:17 EDT 2001


"Steve Holden" <sholden at holdenweb.com> wrote:

>Probably you want to iterate over sys.modules -- one way to do this is:
>
>    for k in sys.modules.keys():
>        module = sys.modules[k]
>        print module.__version__
>
>However you will need to ensure that a particular module HAS a __version__
>attribute before referencing it, or trap the AttributeError exception which
>will result when it doesn't.
>
>regards
> STeve

Excellent. Thanks.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list