How to check version of Python under CGI

Sylvain Thenault thenault at nerim.net
Thu Jun 13 05:22:03 EDT 2002


Johann <observer at NOSPAM.space.pl> writes:

> On Thu, 13 Jun 2002 10:57:21 +0200, Johann <observer at NOSPAM.space.pl>
> wrote:
> 
> >Do you know how to check what modules are installed? E.g. I
> >would like to check if PYANA or other xml modules are installed.
> 
> for x in dir(__builtins__): print x
> 
> Is it all i can get?
this shows you all the built-in methods, not modules.
I think the best way to know if a module is available is to try to import it:

try:
    import pyana
except ImportError:
    print 'pyana not available'

-- 
Sylvain Thénault 



More information about the Python-list mailing list