find out whether a module exists (without importing it)

Gelonida N gelonida at gmail.com
Mon Aug 6 16:48:13 EDT 2012


Is this possible.

let's say I'd like to know whether I could import the module
'mypackage.mymodule', meaning,
whther this module is located somewhere in sys.path

i tried to use

imp.find_module(), but
it didn't find any module name containing a '.'

Am I doing anything wrong?

Is there another existing implementation, that helps.

I could do this manually, but this is something I'd just like to do if 
necessary.





More information about the Python-list mailing list