run_python_script#
- TcpOslServer.run_python_script(script: str, args: Sequence[object] | None = None, run_async: bool = False) Tuple[str, str] | str#
Load a Python script in a project context and execute it.
- Parameters:
- script
str Python commands to be executed on the server.
- args
Sequence[object],None,optional Sequence of arguments used in Python script. Defaults to
None.- run_async: bool, optional
Whether to run the python script as an asynchronous, non-blocking long running operation. If
True, this method returns immediately with the ID of the long running operation instead of waiting for the script to complete. Useget_long_running_operation_status()orwait_for_long_running_operation()to poll for or await its completion. By defaultFalse.Note
Argument is supported for Ansys optiSLang version >= 27.1 only.
- script
- Returns:
- Raises:
OslCommunicationErrorRaised when an error occurs while communicating with server.
OslCommandErrorRaised when the command or query fails.
TimeoutErrorRaised when the timeout float value expires.