Python LIRC extension written in Cython for Python 3 (and 2)
Python Makefile
Switch branches/tags
Nothing to show
Clone or download
tompreston readme: Remove deb references
Package is no longer in debian and the instructions are confusing.
Latest commit f776aa1 Feb 20, 2018




pip3 install python3-lirc


You need a valid lircrc configuration file. For example:

$ cat ~/.lircrc
  button = 1          # what button is pressed on the remote
  prog = myprogram    # program to handle this command
  config = one, horse # configs are given to program as list

  button = 2
  prog = myprogram
  config = two


$ python3
>>> import lirc
>>> sockid = lirc.init("myprogram")
>>> lirc.nextcode()  # press 1 on remote after this
['one', 'horse']
>>> lirc.deinit()

Load custom configurations with:

>>> sockid = lirc.init("myprogram", "mylircrc")
>>> lirc.load_config_file("another-config-file") # subsequent configs

Set whether nextcode blocks or not with:

>>> sockid = lirc.init("myprogram", blocking=False)
>>> lirc.set_blocking(True, sockid)  # or this

Building and Installing

If you want to install manually then you may also need to install cython and some dev libraries:

sudo apt install cython gcc liblircclient-dev python{,3}-{dev,setuptools}

Download, compile and install for Python 3 and 2.

git clone
cd python-lirc/
make py3 && sudo python3 install
make py2 && sudo python install


  1. Install the dev libraries as above.
  2. Make changes to lirc/lirc.pyx.
  3. Compile with make py3 && python3 build
  4. Test with python3 tests/