Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Using Python Interactive Mode on Devices Running Junos OS with Enhanced Automation

 

The Junos OS with Enhanced Automation software image is a full-featured version of Junos OS that bundles additional automation tools with the image and disables Veriexec enforcement. Junos OS variants that do not have enhanced automation have Veriexec enforcement enabled. On these images, unsigned Python scripts must meet certain requirements before you can execute them on the device, and you can only execute the scripts using Python’s normal script mode in which scripts are run in the Python interpreter. By contrast, devices running Junos OS with Enhanced Automation, which are generally used in development environments, enable you to run unsigned Python scripts with fewer restrictions and also use Python interactive mode in the shell.

To invoke Python 2.7 or Python 3 in interactive mode on devices running Junos OS with Enhanced Automation, enter the python or python3 command, respectively, at the shell prompt. Python 3 is available on devices running Junos OS Release 19.4R1 or later.

To start Python in interactive mode:

  1. Start the shell interface:

    user@switch> start shell
  2. Enter the python or python3 command without any parameters:

    % python
Note

The Python interpreter is designated with the prompt >>> at the beginning of a line or ... to indicate the continuation of a line.