ATLAS Offline Software
Tools
PyUtils
python
moduleExists.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
8
from
functools
import
cache
9
import
importlib.util
10
11
12
@cache
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
Generated on Sun Dec 22 2024 21:14:39 for ATLAS Offline Software by
1.8.18