Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

language (Scripts)

Syntax

Hierarchy Level

Description

Enable the execution of unsigned Python scripts on Junos devices, and specify the version of Python used to execute the scripts.

Configuring this statement enables you to execute unsigned Python commit, event, op, and SNMP automation scripts; unsigned Python action and translation scripts for custom YANG modules; and unsigned Python scripts developed using the Juniper Extension Toolkit (JET) on Junos devices. To prevent the execution of unauthorized Python code, unsigned Python scripts must be owned by either the root user or a user in the Junos OS super-user login class, and only the file owner can have write permission for the file.

Note:

Starting in Junos OS Release 16.1R3, unsigned Python scripts must be owned by either root or a user in the Junos OS super-user login class, and only the file owner can have write permission for the file. Prior to Junos OS Release 16.1R3, unsigned Python scripts must be owned by the root user.

Note:

Starting in Junos OS Evolved Release 21.2R1, the junos-defaults configuration group includes the language python statement by default.

Local Python commit, event, op, and SNMP scripts must be configured under the hierarchy level appropriate to the script type, and the filename must include the .py extension. To execute Python op scripts from a remote site, you must configure the allow-url-for-python statement at the [edit system scripts op] hierarchy level.

Default

If you do not include the language (python | python3) statement, and the device does not include the statement in the junos-defaults configuration group, you cannot execute unsigned Python scripts on the device.

Options

(python | python3)

Specify the Python version used to execute Python scripts. Configure python to use Python 2.7, or configure python3 to use Python 3.

If you configure the language python3 statement, the device uses Python 3 to execute scripts that support this Python version, and it uses Python 2.7 to execute scripts that do not support Python 3 in the given Junos OS release. Starting in Junos OS Release 20.2R1, Junos OS uses Python 3 to execute all YANG action and translation scripts. For more information, see Understanding Python Automation Scripts for Devices Running Junos OS.

For JET scripts, you must configure the version of the statement that corresponds to the Python version the script supports. For example, if you configure the language python3 statement for a JET script that only supports Python 2.7, you will receive a runtime error when you execute the script.

Required Privilege Level

maintenance—To view or add this statement in the configuration.

Release Information

Statement introduced in Junos OS Release 16.1R1.

python3 option added in Junos OS Release 19.4R1 for commit, event, op, and SNMP scripts.

python3 option support for JET and YANG scripts added in Junos OS Release 20.2R1.

python3 option added in Junos OS Evolved Release 21.1R1.

python option deprecated in Junos OS Release 21.1R1 and Junos OS Evolved Release 22.3R1.