From f08ea8be028cc2e6efe72c30c5d9d9185d90784f Mon Sep 17 00:00:00 2001 From: syntron Date: Sun, 23 Nov 2025 17:37:14 +0100 Subject: [PATCH 1/2] [OMCSessionPort] add missing function / catch possible errors OMCSessionPort is a limited version as we do not know how OMC is run. --- OMPython/OMCSession.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OMPython/OMCSession.py b/OMPython/OMCSession.py index 861f2a3a..d0bf9135 100644 --- a/OMPython/OMCSession.py +++ b/OMPython/OMCSession.py @@ -1022,11 +1022,27 @@ def __init__( super().__init__() self._omc_port = omc_port + @staticmethod + def run_model_executable(cmd_run_data: OMCSessionRunData) -> int: + """ + Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to + keep instances of over classes around. + """ + raise OMCSessionException(f"({self.__class__.__name__}) does not support run_model_executable()!") + + def get_log(self) -> str: + """ + Get the log file content of the OMC session. + """ + log = f"No log available if OMC session is defined by port ({self.__class__.__name__})" + + return log + def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData: """ Update the OMCSessionRunData object based on the selected OMCSession implementation. """ - raise OMCSessionException("OMCSessionPort does not support omc_run_data_update()!") + raise OMCSessionException(f"({self.__class__.__name__}) does not support omc_run_data_update()!") class OMCSessionLocal(OMCSession): From eae5e65dc83d4b3053a767eab3af524d7cacef70 Mon Sep 17 00:00:00 2001 From: syntron Date: Wed, 26 Nov 2025 20:42:37 +0100 Subject: [PATCH 2/2] [OMCSessionPort] fix exception message --- OMPython/OMCSession.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OMPython/OMCSession.py b/OMPython/OMCSession.py index d0bf9135..ffcfadf2 100644 --- a/OMPython/OMCSession.py +++ b/OMPython/OMCSession.py @@ -1028,7 +1028,7 @@ def run_model_executable(cmd_run_data: OMCSessionRunData) -> int: Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to keep instances of over classes around. """ - raise OMCSessionException(f"({self.__class__.__name__}) does not support run_model_executable()!") + raise OMCSessionException("OMCSessionPort does not support run_model_executable()!") def get_log(self) -> str: """