Check if module is installed

Chris Ortner chris.ortner at googlemail.com
Mon Aug 4 08:57:43 EDT 2008


On Aug 4, 2:25 pm, Kless <jonas.... at googlemail.com> wrote:
> try:
>     import foo
>     foo_loaded = True
> except ImportError:
>     foo_loaded = False

Many projects use this as the standard procedure to check a module's
presence. I assume, this is the best way.

Chris



More information about the Python-list mailing list