Launches an interactive Python shell, with an option to launch a Python script.
Privileged EXEC mode
This command is available only to users with admin-level permissions.
Entering python—with no additional parameters—launches an interactive Python shell.
Entering
python
python-statement launches an interactive Python shell and runs a valid
python-statement
that you enter. For example, entering
python -h invokes the Python shell and displays Python options and arguments.
Entering python python-script-filename launches an interactive Python shell and runs the Python file. (To make a Python file available to this command, copy the Python file to the flash:// location on the device, using the copy command.)
The following example launches the Python shell and then both assigns an SLX CLI operational command to a Python variable and runs that command.
device# python
Python 3.5.2 (default, Apr 11 2019, 13:05:18)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> cmd_show_users = CLI('show users')
!Command: show users
!Time: Tue Aug 9 09:09:39 2016
**USER SESSIONS**
Username Role Host IP Device Time Logged In
jdoe admin 10.11.12.13 Cli 2016-08-09 09:06:46
admin admin 127.1.0.1 Cli 18640
**LOCKED USERS**
Username
no locked users
>>>
The following example (partial) launches the Python shell to run a Python script-file.

Note
For an annotated text of this script, refer to the Extreme SLX-OS Management Configuration Guide > "Python Event-Management and Scripting" > "Python scripts and run-logs."SLX# python create_po.py !Command: show running-config vlan !Time: Fri Dec 16 18:35:41 2016 vlan 1 ! vlan dot1q tag native !Command: config vlan 101-105 !Time: Fri Dec 16 18:35:41 2016 !Command: show running-config vlan !Time: Fri Dec 16 18:35:41 2016 vlan 1 ! vlan 101 ! vlan 102 ! vlan 103 ! vlan 104 ! vlan 105 ! vlan dot1q tag native !Command: show running-config int po !Time: Fri Dec 16 18:35:41 2016 % No entries found. !Command: config int po 10 switchport switchport mode trunk switchport trunk allowed vlan add 101-105 switchport trunk tag native-vlan ; no shut !Time: Fri Dec 16 18:35:41 2016 !Command: show running-config int po !Time: Fri Dec 16 18:35:42 2016 interface Port-channel 10 switchport switchport mode trunk switchport trunk allowed vlan add 101-105
The following example launches the Python shell to test an event-handler script-file.

Note
For more information, refer to the "Python Event-Management and Scripting" > "Guidelines for writing Python scripts" topic in the Extreme SLX-OS Management Configuration Guide.device# python script.py --raslog-triggers {"SH-1002":" Event: exit, Status: success,
Info: User [admin] successfully exited from SLXVM Linux shell. Exit Time: Thu Apr 12 17:29:44 2018"}