Skip to content

Commit 3ab9801

Browse files
penguinpeedavisking
authored andcommitted
Replace deprecated pkgutil.find_loader() (#3043)
That method has been deprecated in Python 3.12 and will be removed from Python 3.14. Replace it with a direct call to `importlib.util.find_spec()`, which `pkgutil.find_loader()` was wrapping around.
1 parent 1f7f068 commit 3ab9801

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/python/test/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pkgutil
1+
import importlib
22
import sys
33

44
def save_pickled_compatible(obj_to_pickle, file_name):
@@ -36,7 +36,7 @@ def is_numpy_installed():
3636
'''
3737
Returns True if Numpy is installed otherwise False
3838
'''
39-
if pkgutil.find_loader("numpy"):
39+
if importlib.util.find_spec("numpy"):
4040
return True
4141
else:
4242
return False

0 commit comments

Comments
 (0)