Skip to content

Commit d0413ab

Browse files
authored
feat(operator_doc): allow plugin load to fail for composites and sound (#2709)
1 parent 0230bde commit d0413ab

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

src/ansys/dpf/core/documentation/generate_operators_doc.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import os
2828
from pathlib import Path
2929
import re
30+
import warnings
3031

3132
from ansys.dpf import core as dpf
3233
from ansys.dpf.core.changelog import Changelog
@@ -90,17 +91,27 @@ def initialize_server(
9091
binary_name = "composite_operators.dll"
9192
else:
9293
binary_name = "libcomposite_operators.so"
93-
load_library(
94-
filename=Path(server.ansys_path) / "dpf" / "plugins" / "dpf_composites" / binary_name,
95-
name="composites",
96-
)
94+
try:
95+
load_library(
96+
filename=Path(server.ansys_path)
97+
/ "dpf"
98+
/ "plugins"
99+
/ "dpf_composites"
100+
/ binary_name,
101+
name="composites",
102+
)
103+
except Exception as e:
104+
warnings.warn("Could not load Composites plugin:" f"{e}")
97105
if include_sound and server.os == "nt": # pragma: nocover
98106
if verbose:
99107
print("Loading Acoustics Plugin")
100-
load_library(
101-
filename=Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll",
102-
name="sound",
103-
)
108+
try:
109+
load_library(
110+
filename=Path(server.ansys_path) / "Acoustics" / "SAS" / "ads" / "dpf_sound.dll",
111+
name="sound",
112+
)
113+
except Exception as e:
114+
warnings.warn("Could not load Acoustics plugin:" f"{e}")
104115
if verbose: # pragma: nocover
105116
print(f"Loaded plugins: {list(server.plugins.keys())}")
106117
return server

0 commit comments

Comments
 (0)