[Tutor] testing for modules?

Shitiz Bansal shitizb at yahoo.com
Tue Oct 25 10:48:33 CEST 2005


try:
   import <modulename>
except:
   <install module>
   import <modulename>


--- Ed Hotchkiss <edhotchkiss at gmail.com> wrote:

> i have a generic script that is using several
> modules on windows and linux
> boxes. i need to have the scripts test if a module
> is installed, and then if
> not - then to install the module. can anyone give me
> a headsup on how to
> test for a module, returning something to indicate
> whether or not it is
> installed, then after that executing file to install
> the module.? just
> somewhere to start would be helpful! thanks in
> advance.
> 
> --
> edward hotchkiss
> > -- 
> http://mail.python.org/mailman/listinfo/python-list


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list