Python scripting - with input table
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:
- as single files, where the file is linked in the operator settings and can be directly loaded and edited, or
- bundled in a Python ZIP file.
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 | |
from v7.0 |
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. 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 run, create_table, simple_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.