简体   繁体   中英

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")

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM