I installed and configured Lirc on my Raspi, then I installed python-lirc. The Lirc configuration is OK, as I can use irw and irsend with no problem.

In my python program, when I try to read any IR code sent by my remote, the lirc.nextcode() function always return an empty list. The code is:

while (True):
    try:
            list = lirc.nextcode()
            if len(list) != 0: print "match!"
    except KeyboardInterrupt:
            lirc.deinit()
            break;

Also tried with pylirc library and have the same problem. Any idea? Thanks!

This seems unanswered elsewhere as well. 'lirc.nextcode() gives [] instead of key'

Your python script presumably has something like this before the lines you show?

sockid=lirc.init("myprogram")

Try adding the path of the .lircrc to the second init param:

sockid=lirc.init("myprogram","/home/pi/.lircrc")

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.