Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Python runtime



There are three ways to define the Python runtime which will call Python scripts:
  • Through the pythonDefaultRuntime property with the python2 or python3 values in the framework properties: it will look for a Python2 or Python2 installed version of Python
  • Through the pythonRuntime or pythonRuntimeEnv properties in the framework properties: it will set the default runtime to use for all Python scripts
  • Through the optional pythonRuntime element in each Python module specification: it will override the default runtime for each particular module
Note that if no runtime is specified, the framework will look for a Python 2.x executable among the applications installed on the System.

Python runtime element attribute

The pythonRuntime element in the framework properties or a Python module specification has the following attributes:

General attributes

  • path: the path of the Python executable
  • env: the Python environment value if Python is installed as an installed environment runtime
  • stripModuleFromLogs: true if the module name must be stripped from the logs coming from Python
  • compatibility: the Python modules version compatibility
  • condition: use a condition to enable the runtime declaration

The path and env attributes are exclusive. One of these two attributes must be present.

Attributes specific to Anaconda


These attributes are specific to an Anaconda installation:
  • anaconda: true for an Anaconda Python installation
  • anacondaEnv: to specify the Anaconda environment in which Python must be started
  • echoOff: by default, an echo off instruction is added to the Anaconda launch script. By setting the associated value to false, this instruction will not be added, and the console shows the execution of the launcher script

Using Python with Anaconda


The pythonRuntime property allows to specify that the Python runtime is an Anaconda install. For example:
      <files>
      ...
         <pythonRuntime path="L:/WRK/Anaconda3/python.exe" anaconda="true" />
      </files>

Usage on Linux or MAC OS X

On Unix systems, the path for python (for example /usr/bin/user/python) is not a valid executable path. It is better to use the pythonRuntimeEnv property or the env parameter in the Python module with the value of the environment variable. For example for framework properties:
      <files>
      ...
         <property key="pythonRuntimeEnv" value="python38" />
      </files>

Examples

Specification of the default Python executable

      <files>
      ...
         <property key="pythonDefaultRuntime" value="python3" />
      </files>

Specification in the framework properties

      <files>
      ...
         <property key="pythonRuntime" value="C:/Program Files (x86)/Python24/python.exe" />
      </files>

Specification in the Python module

      <pythonModule name="FlightManagementSystem" >
         <pythonImplementation path="pythonAppli" >
              <pythonRuntime path="C:/Program Files (x86)/Python24/python.exe" />
         </pythonImplementation>
      </pythonModule>
or:

      <pythonModule name="FlightManagementSystem" >
         <pythonImplementation path="pythonAppli" >
              <pythonRuntime env="python24" />
         </pythonImplementation>
      </pythonModule>

See also


Categories: concepts | python

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence