You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
import lirc
import time
sockid = lirc.init("python3", ".lircrc". blocking=False)
while True:
try:
button = lirc.nextcode()
print("Looped!")
if len(button) == 0: continue
print(button[0])
time.sleep(1)
except KeyboardInterrupt:
lirc.deinit()
break
This should print "Looped!" every second, and also print the button pressed otherwise. But the program stops (is blocked) at the nextcode() line until a button is pressed. It then passes on the button, and a handful of zero length returns, then goes back to blocking.I've also tried with the separate "set_blocking" line. I can see in the code where it is supposed to set the O_NONBLOCK flag, so maybe it's a bug in LIRC? I'm really new to python, so if I'm misunderstanding something, just let me know please.