Skip to content
This repository was archived by the owner on Nov 19, 2020. It is now read-only.
This repository was archived by the owner on Nov 19, 2020. It is now read-only.

python3 lirc.nextcode() seems to block even when blocking set to False #2

@VengefulPikachu

Description

@VengefulPikachu

Wrote very short program to demonstrate this:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions