Not sure what's wrong here, function's not printing anything (tried '1' as argument i). I've seen an answer suggesting adding flush=True to print, but that doesn't solve the issue. Any hints appreciated! More broadly - should I even be using the try/except framework if I want the function to be keyboard-controled, or is there a better way?
def i_printer(i):
    while True:
        try:
            if keyboard.is_pressed('q'):
                break
        except:
            print(i)
            time.sleep(3)
EDIT: using Windows, apparently keyboard doens't work with it, looking for different solution.
 
    