python(
SOURCE
)

The python( function executes a python program and returns the result (stdout).


Parameters

This function has one parameter:

source – Python script (source code). Note: It is very convenient to use “pipe” delimiters for this parameter, for example |||script|||. This eliminates needing to worry about the delimiters that occur in the script itself.


Description

This function executes Python source code and returns the result. Here is a simple example.

python({print "Hello World"}) ☞ Hello World

WARNING: Apple has stopped providing Python with macOS. If you are using a recent version of macOS, you will have to install Python yourself. See Scripting Language Configuration to learn how to do this.


Panorama formulas can be embedded in the Python source code using special tags. To embed a Panorama formula use

$«formula»$

The formulas are calculated in advance, then embedded into the source code as constants. For example, the formula $«2*3»$ will be embedded into the program as 6. The formula $«upper("hello world")»$ will be embedded as "HELLO WORLD". Note: You can embed database fields, global variables, fileglobal variables, and windowglobal variables into the formula, but local variables will not work. (You can, however, use local variables with the python statement.)

In the case of text formulas any special characters will be encoded as necessary for a proper Python constant. For example the formula $«{"}»$ will be embedded as "\x22".

To embed a Panorama formula with no quotes or translation use

^«formula»^

See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0.