2

I am needing to use the LIRC Python client bindings for a project. The LIRC website has good documentation over them, but I have no idea how to actually get them besides copying and pasting the python code. It never says anywhere on the site that I have seen where to actually get them.

Where/how do I get these bindings?

http://www.lirc.org/html/lirc_client.html

http://www.lirc.org/api-docs/html/group__python__bindings.html

Dane Lowrey
  • 170
  • 1
  • 10

3 Answers3

0

I think you need to install python-lirc or python3-lirc available on PyPi.

This is a Python binding to LIRC.

Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103
  • `python-lirc` is/was never the official LIRC Python client binding package. Meanwhile the python-lirc package is EOL. – Robert Jul 23 '23 at 10:14
0

You could install the latest version available on the upstream site: http://sf.net/p/lirc. This is the version actually described in the docs. The pypi described in previous reply is another beast.

leamas
  • 151
  • 1
  • 6
  • After I've installed LIRC, how do I access the Python module like it does in the documentation `import lirc`? – Dane Lowrey Aug 13 '18 at 23:46
  • Depends on how you ran configure; with default options you should find the package in something like /usr/local/share/lirc/python-pkg/. There you could find the README.rst for more info – leamas Aug 15 '18 at 09:22
0

On Debian/Raspbian you only need lirc package. It contains the lirc Python bindings package sources unpacked and as tar.gz file.

You can install the lirc Python bindings to a currently active venv is for example by this command:

pip3 install /usr/share/lirc/lirc-0.10.1.tar.gz

The command above works for Raspbian GNU/Linux 12 (bookworm), for your Linux distribution and lirc version you may have to adapt it.

Test scripts for testing functionality of lirc python bindings:

import lirc
print(lirc.get_default_socket_path())

Outputs /var/run/lirc/lircd

with lirc.RawConnection('/var/run/lirc/lircd') as conn:
    press = conn.readline()
    print(press)

If you omit the parameter '/var/run/lirc/lircd' the default socket path printed by example 1 is used.

import lirc

with lirc.LircdConnection('mylirc') as conn:
    while True:
        string = conn.readline()
        print(string)

The 'mylirc' argument is taken form /etc/lirc/lircrc where each key is defined. It is there defined as prog = mylirc in each begin/end block.

Robert
  • 39,162
  • 17
  • 99
  • 152