I have the following 2 extracts of starting pynput's keyboard listener.
# Collect events until released
with keyboard.Listener(
on_press=on_press,
on_release=on_release) as listener:
listener.join()
# ...or, in a non-blocking fashion:
listener = keyboard.Listener(
on_press=on_press,
on_release=on_release)
listener.start()
Im using Python 3.10.10
I tried using both of them but only the first one is working properly,its reading my input and keeps running. The second one just ends the program without reading any input at all. It also doesn't provide any output.
No error message is given.
What is the difference between those 2 and why is only the first one working?