Re: Check if module is installed

2008-08-04 Thread Steven D'Aprano
On Mon, 04 Aug 2008 05:25:08 -0700, Kless wrote: > 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

Re: Check if module is installed

2008-08-04 Thread Wojtek Walczak
Dnia Mon, 4 Aug 2008 05:25:08 -0700 (PDT), Kless napisa�(a): > 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. You may also be interested in techniques to keep your software compatible with older versions of python. Tak

Re: Check if module is installed

2008-08-04 Thread Chris Ortner
On Aug 4, 2:25 pm, Kless <[EMAIL PROTECTED]> 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 -- http://mail.python.org/mailman

Check if module is installed

2008-08-04 Thread Kless
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! -- http://mail.python.org/m