Shared Session: work with Python and XOE together

This tutorial only applies to the scenario that you are performing python code in your local python environment with your custom python console, IDE or jupyter notebook .

If python is started from embedded XOE Python IDE or JupyterLite, the session is automatically shared with XOE. You need simply call xplain.Xsession() to instantiate the shared xplain session.

Shared Session: work with Python and XOE together

Python and Xplain Object Explorer (XOE) can work together seamlessly. Python and XOE can work on the same xplain session, that means XOE will visualize update immediately once any changes on xplain session has been done via Python script. And vice versa, after you have performed any analyse on XOE, you can keep working on the current result further with Python. This session sharing feature leverages the complementary advantages of both tools. This tutorial shows how to establish a connection between Python and XOE and work on a shared xplain session.

Scenario 1:

User have started Object Explorer first, Python take over session id from XOE

To share the same session with Python, user has to retrieve the current session ID from XOE first. In Settings select the check box “Enable Developer Mode”

After this change is made, you have to refresh the XOE via browser refresh Ctr+R /Cmd + R / F5

Go to Settings/Session, copy the Session ID to clipboard

Instantiate the xplain.Xsession object and connect it to xplain server, then paste the session ID as paramter of function load_from_session

>>> import xplain

>>> x = xplain.Xsession(url="host:8080",user="myUser", password="myPassword")
>>> x.load_from_session_id("A674FF134333C72CE2ICE1782B8006C")

Scenario 2:

Python has started the xplain session from a startup configuration first, XOE takes over the session from Python

Instantiate the xplain.Xsession object and connect it to xplain server, then start a xplain session by calling the function startup() with startup configuration file as parameter. Retrieve the session ID with function get_session_id()

>>> import xplain

>>> x = xplain.Xsession(url="host:8080",user="myUser", password="myPassword")
>>> x.startup('DemoStartUp')
>>> x.get_session_id()

A674FF134333C72CE2ICE1782B8006C

Copy the displayed session ID to clipboard

Start XOE, enter the session Id into field “Config file” and click “Okay”

Last updated