launch_session#

ansys.edb.core.session.launch_session(ansys_em_root, port_num=None, dump_traffic_log=False)#

Launch a local session to an EDB API server.

Shared-memory IPC is used automatically when launching a local server. If the installed server does not support shared memory, the session falls back to standard gRPC communication transparently.

The session must be manually disconnected after use by calling session.disconnect()

Parameters:
ansys_em_rootstr

Directory where the EDB_RPC_Server.exe file is installed.

port_numint or None, default: None

Port number to listen on. The default is None, in which case a port in [50051, 60000] is selected.

dump_traffic_logbool, default: False

Flag indicating if the network traffic log should be dumped when the session is disconnected.

Examples

Create a session and then disconnect it

>>> session = launch_session("C:\\Program Files\\AnsysEM\\v231\\Win64", 50051)
>>> # program goes here
>>> session.disconnect()