Personal tools
The Open Lighting Project has moved!

We've launched our new site at This wiki will remain and be updated with more technical information.

OLA Python API


Revision as of 17:45, 19 January 2011 by Nomis52 (talk | contribs)
Jump to: navigation, search

Building the Python Bindings

You should install readline if you haven't already:

sudo easy_install readline

You need the python version of protocol buffers installed.

See Building OLA but run

$ ./configure --enable-python-libs

Check where the modules are going to be installed:

$ grep ^pythondir config.log

Run the usual: make, make check, make install.

Check that the modules have been installed correctly in the $pythondir above.

Check that $pythondir appears in sys.path:

$ python -c "import sys; print sys.path"

If it doesn't add it to $PYTHONPATH:

$ export PYTHONPATH=$PYTHONPATH:/path/to/your/install/dir

You probably want to put this line in your shell .rc file.

Interesting Classes

A helper class that connects to the server and creates a new OlaClient
The main API

The best documentation is the set of example programs in the python/examples directory.

Sending DMX

A simple example to send DMX:

import array
from ola.ClientWrapper import ClientWrapper

def DmxSent(state):

universe = 1
data = array.array('B')
wrapper = ClientWrapper()
client = wrapper.Client()
client.SendDmx(universe, data, DmxSent)

Receiving DMX

Here is some code to receive DMX on universe 1.

from ola.ClientWrapper import ClientWrapper

def NewData(data):
  print data

universe = 1

wrapper = ClientWrapper()
client = wrapper.Client()
client.RegisterUniverse(universe, client.REGISTER, NewData)