Check if module is installed

Kless jonas.esp at googlemail.com
Mon Aug 4 14:25:08 CEST 2008


How to check is a library/module is installed on the system? I use the
next code but it's possivle that there is a best way.

-------------------
try:
    import foo
    foo_loaded = True
except ImportError:
    foo_loaded = False
-------------------


Thanks in advance!



More information about the Python-list mailing list