Developing in Python

The Python libraries are generated automatically from the C++ header files. Python versions 2.7 and 3.x are supported.

Configure your environement for Windows

To use you need to set your PYTHONPATH and your PATH variables:

set PAPILLON_INSTALL_DIR=put your Papillon folder here...
set PATH=%PAPILLON_INSTALL_DIR%\bin;%PATH%
set PYTHONPATH=%PAPILLON_INSTALL_DIR%\bin;%PYTHONPATH%

Configure your environement for Linux

To use you need to set your PYTHONPATH and your LD_LIBRARY_PATH variable to ${PAPILLON_INSTALL_DIR}/lib

export PAPILLON_INSTALL_DIR=/opt/Papillon
export LD_LIBRARY_PATH=/opt/Papillon/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/Papillon/lib:$PYTHONPATH

How to use Papillon SDK in your Python script?

In your Python script simply add Papillon as an import statement at the top. Then usually the first thing you want to do is Initialise the SDK i.e.

### Python 2

import Papillon as papillon
papillon.PapillonSDK.Initialise().OrDie()

### Python 3

import Papillon3 as papillon
papillon.PapillonSDK.Initialise().OrDie()

As the Python is generated automatically we have not yet got a nice way to automatically generate Python specific documentation. However, the code is nearly identical to the C++ code. As ever, the best way to learn is by looking at the examples below.