Python

The Python node supports *.py, *.Py, *.PY input files. After opening an input file, the file is displayed in the integration dialog and suggested assignments are listed in thetable of suggested assignments.

Execution settings
OptionDescription
Python environment

Specifies the type of Python environment to use. The default value is optiSLang Python.

You can chose between different Python environments that are installed on the system, for example, Python 3.5.64 bit or Anaconda 3.5 64 bit.

Additional Python environment can be made available by adding the location to the PATH environment variable or to the optiSLang.ini file.

A 64 bit Python environment is required as only shared libraries (*.dll, *.so) are supported.

optiSLang Python can be extended with additional packages.

Distinct working directoryWhen selected, creates an extra directory in the design directories for calculations.
Run Options

This node has general Run Options. The number of supported options is individual for each node.

Requirements for Python Scripts

From version 4.0.5, there are some predefined variables that can be used in Python scripts.

All parameters in the Python script must be defined in the following way:

        try:
            test = m
        except:
            m = 1.00000000
        try:
            test = k
        except:
            k = 20.00000000
        try:
            test = D
        except:
            D = 0.02000000
        try:
            test = Ekin
        except:
            Ekin = 10.00000000
    

The parameter values are provided to Python and then the script is run, if the variables are hard-coded without this workaround, they are overwritten by the script.

From version 4.1.2, the Python node runs out of process. optiSLang is not influenced if the Python process crashes or runs in an endless loop. The process can be killed without killing optiSLang as well.

Standard Slots

Besides the common integration slots the Python 2 node has the following slots.

Slot NameSlot TypeData TypeDescription
InOut
Pathx  Path to Python 2 source file.
StdErr x Standard error output of the Python 2 run.
StdOut x Standard output of the Python 2 run.
Supported Versions

See the Supported Integration Versions table.