Skip to content

Commit 15e4ded

Browse files
authored
Linux grpc support to pyaedt (#1272)
* Added support for Linux Grpc API in 2022R2 * Added support for Linux Grpc API in 2022R2 Co-authored-by: maxcapodi78 <Shark78>
1 parent 9b61785 commit 15e4ded

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pyaedt/desktop.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
_com = "pywin32"
6868
else:
6969
raise Exception("Error. No win32com.client or Pythonnet modules found. Install them and try again.")
70+
else:
71+
_com = "pythonnet_v3"
7072

7173

7274
def _check_grpc_port(port, machine_name=""):
@@ -168,7 +170,7 @@ def release_desktop(close_projects=True, close_desktop=True):
168170
for project in projects:
169171
desktop.CloseProject(project)
170172
pid = _main.oDesktop.GetProcessID()
171-
if not is_ironpython:
173+
if _com != "pythonnet_v3":
172174
if settings.aedt_version >= "2022.2" and settings.use_grpc_api:
173175
import ScriptEnv
174176

@@ -625,6 +627,15 @@ def _init_cpython_new(self, non_graphical, new_aedt_session, version, student_ve
625627
base_path = self._main.sDesktopinstallDirectory
626628
sys.path.append(base_path)
627629
sys.path.append(os.path.join(base_path, "PythonFiles", "DesktopPlugin"))
630+
if os.name == "posix":
631+
if os.environ.get("LD_LIBRARY_PATH"):
632+
os.environ["LD_LIBRARY_PATH"] = (
633+
os.path.join(base_path, "defer") + os.pathsep + os.environ["LD_LIBARY_PATH"]
634+
)
635+
else:
636+
os.environ["LD_LIBRARY_PATH"] = os.path.join(base_path, "defer")
637+
pyaedt_path = os.path.realpath(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
638+
os.environ["PATH"] = pyaedt_path + os.pathsep + os.environ["PATH"]
628639
import ScriptEnv
629640

630641
launch_msg = "AEDT installation Path {}".format(base_path)

0 commit comments

Comments
 (0)