Check if module is installed

Kless jonas.esp at googlemail.com
Mon Aug 4 08:25:08 EDT 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