How to test if a module exists?

Roy Smith roy at panix.com
Tue Nov 9 13:30:45 CET 2010


In article <ibatkk$t7p$4 at lust.ihug.co.nz>,
 Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> wrote:

> In message <roy-4C92BB.16523506112010 at news.panix.com>, Roy Smith wrote:
> 
> > On the other hand, if your module's bug is that it in turn imports some
> > other module, which doesn't exist, you'll also get an ImportError.
> 
> Does it really matter? Either way, the module is unusable.

If I understand correctly, he's trying to differentiate between:

1) The module is unusable because it's not installed

2) The module is unusable because it has a bug in it.

The later case implies he needs to find and fix the bug.



More information about the Python-list mailing list