Skip to content

Commit 3514ccc

Browse files
committed
Remote Operators Fix2
Signed-off-by: paul.profizi <[email protected]>
1 parent cda3fc2 commit 3514ccc

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/ansys/dpf/core/server_factory.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import logging
99
import os
1010
import subprocess
11-
import sys
1211
import time
1312
import io
1413

@@ -609,11 +608,7 @@ def get_server_type_from_config(
609608
ansys_path = os.environ.get("AWP_ROOT" + str(__ansys_version__), None)
610609
if ansys_path is not None:
611610
sub_folders = os.path.join(ansys_path, _get_path_in_install())
612-
if not os.name == "posix":
613-
previous_path = subprocess.check_output(["echo", "%PATH%"], shell=True).decode(sys.stdout.encoding)
614-
else:
615-
previous_path = os.environ["PATH"]
616-
os.environ["PATH"] = previous_path + sub_folders
611+
os.environ["PATH"] += sub_folders
617612
return GrpcServer
618613
elif config.protocol == CommunicationProtocols.InProcess and not config.legacy:
619614
return InProcessServer

src/ansys/dpf/core/server_types.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
import socket
1111
import subprocess
12+
import sys
1213
import time
1314
import warnings
1415
import traceback
@@ -925,6 +926,15 @@ def __init__(
925926
self._context = server_context.AvailableServerContexts.premium
926927
pass
927928
self.set_as_global(as_global=as_global)
929+
# Update the python os.environment
930+
if not os.name == "posix":
931+
path_str = "%PATH%"
932+
else:
933+
path_str = "$PATH"
934+
new_path = subprocess.check_output(
935+
["echo", path_str], shell=True
936+
).decode(sys.stdout.encoding)
937+
os.environ["PATH"] = new_path
928938

929939
@property
930940
def version(self):

src/ansys/dpf/gate/load_api.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import os
2-
import subprocess
3-
import sys
4-
52
import packaging.version
63
import pkg_resources
74
import importlib
@@ -246,8 +243,7 @@ def load_grpc_client(ansys_path=None):
246243
# on libcrypto and libssl
247244
previous_path = ""
248245
if not ISPOSIX and ANSYS_PATH is not None:
249-
# previous_path = os.getenv("PATH", "")
250-
previous_path = subprocess.check_output(["echo", "%PATH%"], shell=True).decode(sys.stdout.encoding)
246+
previous_path = os.getenv("PATH", "")
251247
os.environ["PATH"] = path + ";" + previous_path
252248

253249
grpc_client_api_path = os.path.join(path, name)

0 commit comments

Comments
 (0)