ATLAS Offline Software
Functions
python.moduleExists Namespace Reference

Functions

def moduleExists (modName)
 

Function Documentation

◆ moduleExists()

def python.moduleExists.moduleExists (   modName)
Test for the existence of a module without actually importing it.

We could just do
  try:
import modName
  except ImportError:
...
except that that has the potential to hide other errors.

Definition at line 13 of file moduleExists.py.

13 def moduleExists (modName):
14  """Test for the existence of a module without actually importing it.
15 
16 We could just do
17  try:
18  import modName
19  except ImportError:
20  ...
21 except that that has the potential to hide other errors."""
22 
23  return importlib.util.find_spec (modName) is not None
python.moduleExists.moduleExists
def moduleExists(modName)
Definition: moduleExists.py:13