Summary

Applies a Python script to the current data node.

The script takes can read and write data from the following sources:

  •  The result table of the current data node,
  • Result tables of othter data nodes,
  • TIS Files,
  • Parameters, and
  • some metadata like the TIS version or the user name (only read access).


Python scripts can stored on the server's file system in two ways:


Either the single file or the __main__.py file in the ZIP file must contain one of the functions run, simple_main, create_table, and  main (legacy), seePython scripting functions


The python version of the interpreter depends on the TIS version:

TIS release

Python version

from v 6.6

Python 3.9

from v7.0

Python 3.11


Modules from the Python Standard Library can be imported. Other modules can be imported if they have been included in the current deployment.

As a convention, 4-space indentation should be used instead of tabs, see PEP Style Guide(warning) When pasting python scripts into the operator's editor, tab indentations are converted to 4-space indentations.

The operator looks for the functions one of the functions of the functions runcreate_tablesimple_main, and main to start execution.

The environment variable LANGUAGE (os.environ['LANGUAGE']) is set to the user's language. The project's language is ignored.


Settings

Parameter

Type

Opt.

Description

Example

Select Python script file

System.Object


Path to TIS File containing the Python script

-

Evaluation timeout (ms)

System.Int


Maximum execution time. If exceeded, the operation terminates with an error.

This value must be set between 1.000ms and 2.147.483.647ms.

20000

Python interpreter

CPython

Pypy


Choice between two interpreters.

Pypy can be faster in some use cases.


Input data nodes


Opt.

List of data nodes whose result tables are provided via the run function's second argument. By convention, this argument is named intables or in_tables. They are lists of generators. Each generator iterates the result table of an input data node. The generator at index 0 refers to the current result table. The result tables of the input data nodes start at index 1.


Output TIS Tables


Opt.

List of paths to TIS Tables that can be written via the run function's third argument. By convention, this argument is named outtables or out_tables. They are objects that can receive the output synchronously or asynchronously. Refer to the description of the run function for more information.


Input files


Opt.

List of files that can be read in the script, see TIS File I/O in python scripting.


Output file paths


Opt.

List of files that can be written by the script, see TIS File I/O in python scripting.


Related topics