Check module without import it

K

Kless

Is there any way to check that it's installed a module without import
it directly?

I'm using the nex code but it's possible that it not been necessary to
import a module

-----------------
try:
import module
except ImportError:
pass
else:
print 'make anything'
-----------------
 
M

member thudfoo

Is there any way to check that it's installed a module without import
it directly?

I'm using the nex code but it's possible that it not been necessary to
import a module

-----------------
try:
  import module
except ImportError:
  pass
else:
  print 'make anything'
-----------------

Have a look at find_module in the imp module of the standard library.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top