Skip to content

Commit 79b1e24

Browse files
committed
Revert "Remove usage of deprecated pkgutil.get_loader"
This reverts commit 4cec942.
1 parent ac8e69e commit 79b1e24

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ansys/dpf/core/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import importlib.util
21
import os
32

43
try:
@@ -12,16 +11,18 @@
1211
USER_DATA_PATH = None
1312
LOCAL_DOWNLOADED_EXAMPLES_PATH = None
1413
try:
15-
spec = importlib.util.find_spec(name=__name__)
16-
USER_DATA_PATH = os.path.dirname(spec.origin)
14+
import pkgutil
15+
16+
spec = pkgutil.get_loader(__name__)
17+
USER_DATA_PATH = os.path.dirname(spec.get_filename(__name__))
1718
if not os.path.exists(USER_DATA_PATH): # pragma: no cover
1819
os.makedirs(USER_DATA_PATH)
1920

2021
LOCAL_DOWNLOADED_EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")
2122
if not os.path.exists(LOCAL_DOWNLOADED_EXAMPLES_PATH): # pragma: no cover
2223
os.makedirs(LOCAL_DOWNLOADED_EXAMPLES_PATH)
23-
except Exception as e: # pragma: no cover
24-
raise e
24+
except: # pragma: no cover
25+
pass
2526

2627
installed = [d.metadata["Name"] for d in importlib_metadata.distributions()]
2728
check_for = ["ansys-dpf-gatebin", "ansys-dpf-gate", "ansys-grpc-dpf"]

0 commit comments

Comments
 (0)