%Python Server
Synopsis
[Gateways]
%Python Server=Python,Port,[optional fields]
Description
%Python Server is the name of the Python gateway definition in the default CPF, but additional Python gateways with different names can be created and existing gateways can be edited or deleted as described in [Gateways]. Each definition consists of a name followed by = and then a comma-separated list of values defining the gateway; some fields are required, and others can be left blank, in which case default values are used. Fields specific to Python gateways and those that can be used with all gateways are described in the following two sections. For a more detailed description, see Python External Server Setup and Defining External Server Configurations for Python.
Python Gateway Fields
The first three fields in a Python gateway definition are common to all gateways and the next three are specific to Python gateways. These are shown in order in the following:
-
Type (required) — Type of the gateway. When defining a Python gateway, this is set to Python.
-
Port (required) — TCP port number for communication between the gateway and the proxy classes in InterSystems IRIS. This port number must not conflict with any other local TCP port on the server.
-
Resource — The gateway resource that controls access to this gateway; for %Python Server in the default CPF, this is %Gateway_SQL.
Important:If no resource is specified, the gateway is public, but InterSystems strongly recommends protecting all gateways using this mechanism.
-
PythonPath — Location of the Python interpreter, used in assembling the command to start the gateway on the local server.
Important:This field is required unless a default Python interpreter is set for the host system.
-
PythonOptions — Python options to be included in the command to start the gateway on the local server.
-
PythonCreateVirtualEnvironment|PythonPathVar — This field is a combination of the PythonCreateVirtualEnvironment and PythonPathVar properties separated by the | character.
PythonCreateVirtualEnvironment specifies whether a Python virtual environment is created and used. It is a boolean with a default value of 1, this matches the existing behavior where a virtual environment is created containing the intersystems-irispython package when this external language server is started for the first time. Specify 0 to use the Python environment specified in PythonPath. If PythonCreateVirtualEnvironment is 0, the user is responsible for ensuring that the intersystems-irispython package is installed in this Python environment.
PythonPathVar specifies the value of the PYTHONPATH environment variable. This allows Python packages installed in an arbitrary location to be used. The default is blank, which means that the system environment variable settings are used. The | character is not allowed in this field. See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATHOpens in a new tab for more information.
General Gateway Fields
The remaining eight fields can be used in any gateway definition, and are shown in the General Gateway Fields section under %DotNet Server.
Changing This Parameter
For information about changing and adding gateway definitions, see [Gateways].