Adam Röhr
Adam Röhr

Reputation: 31

Keyboard library python3

I am trying to do a python script and while the script is running in the background I want it to listen at some buttons, the problem is that I can't even this simple program to get to work, I get segmentation fault 11. When I run it I use sudo python3 prog.py.

import keyboard
keyboard.wait('esc')
print("test")

Upvotes: 0

Views: 586

Answers (1)

Adam Elamy
Adam Elamy

Reputation: 11

Couple of things:

  1. You don't compile a Python program
  2. The problem is that you don't have permission to access that memory, hence the segfault. The fix depends on your system, on my Mac I just changed the permissions of the terminal (so that it could control my computer).
  3. Also, I just want to mention that a process in the background does not take in data from STDIN, so you may have a problem there depending on what you mean.

Upvotes: 1

Related Questions