pythonModule.py
(or pythonHttpModule.py
) script is responsible for the Services subscription in the Python environmentpythonUtils.py
(or pythonHttpUtils.py
) script is an utility script usable by the user Python scriptpythonModule
element. <pythonModule name="FlightManagementSystem">For http modules:
<pythonHttpModule name="FlightManagementSystem">
pythonImplementation
element declares the Python script file which implements the script, and specified associated properties. The content of this element depends of the type of Python module:
waitAtStart
attribute specifies the maximum duration to wait for after the start of the Python script. This is necessary to allow the Python executable to start-up. By default the duration will be specified as 200 ms if not defined.
pythonRuntime
element. This element has two possible attributes:<pythonModule name="FlightManagementSystem" > <pythonImplementation path="pythonAppli" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"> <pythonRuntime path="C:/Program Files (x86)/Python24/python.exe" /> </pythonImplementation> </pythonModule>or:
<pythonModule name="FlightManagementSystem" > <pythonImplementation path="pythonAppli" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"> <pythonRuntime env="python24" /> </pythonImplementation> </pythonModule>
PATH
environment variablesystemEnv
element:env
children allow to define regular environment variablesenvPath
children allow to define environment variables which define a directory or file path. The parser will make sure that the corresponding paths will be converted to absolute paths, even if the paths are defined relative to the directory of the Python script.append
attribute specifies if the path will be added to the current value of the environment variable or if it will replace it<pythonModule name="FlightManagementSystem" > <pythonImplementation path="pythonAppli" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"> <systemEnv> <env key="MYENV" value="toto" /> <envPath key="PATH" path="toto.xml" append="false" /> <envPath key="PATH" path="titi.xml" append="true" /> </systemEnv> </pythonImplementation> </pythonModule>In that case, the values for the
MYENV
and PATH
environment variables will be:MYENV=toto PATH=<path of the applications.xml parent directory>/toto.xml;<path of the applications.xml parent directory>/titi.xml
myPythonAppli.py
, then the path parameter must be myPythonAppli
, and the class defined in the module must be named MyPythonAppli
.<pythonModule name="FlightManagementSystem" id="1" > <pythonImplementation path="pythonAppli" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"/> </pythonModule>and:
from pythonUtils import PythonUtils class PythonAppli:However, it is possible to specify the name of the class to call in the module by using the
className
parameter.<pythonModule name="FlightManagementSystem" id="1" > <pythonImplementation path="pythonAppli" className="FMS" inputPort="6000" outputPort="6005" inputSize="1024" outputSize="1024"/> </pythonModule>and:
from pythonUtils import PythonUtils class FMS:
PythonUtils
class in the pythonUtils
modulepythonModule.py
and pythonUtils.py
scripts must change when the communication between Java and Python is upgraded.pythonModule.py
script check if its own version is compatible with the version proviced by Java. This means that you normally should replace the pythonModule.py
and pythonUtils.py
scripts if the Python modules version changes.
pythonModule.py
(or pythonHttpModule.py
) scriptpythonUtils.py
(or pythonHttpUtils.py
) scriptCopyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence