[英]keyboard.is_pressed() not permitted in mac os Catalina
I'm using mac os Catalina and I need to use我正在使用 mac os Catalina,我需要使用
keyboard.is_pressed('a')
in my code.在我的代码中。 it raises this error:它引发了这个错误:
OSError: Error 13 - Must be run as administrator OSError:错误 13 - 必须以管理员身份运行
I also use sudo
:我也使用sudo
:
sudo python main.py
it raises this error:它引发了这个错误:
2019-12-30 21:52:05.719 Python[6717:186981] ApplePersistenceIgnoreState: Existing state will not be touched. 2019-12-30 21:52:05.719 Python[6717:186981] ApplePersistenceIgnoreState:不会触及现有状态。 New state will be written to (null)新状态将被写入(空)
Segmentation fault: 11分段错误:11
to be noted that I need to check if a
is pressed or not.需要注意的是,我需要检查a
是否被按下。 if no key pressed the progress should be continued.如果没有按下任何键,则应继续进行。 so getting input cannot solve this because the flow waits till that key be pressed.所以获取输入无法解决这个问题,因为流程一直等到那个键被按下。 How can I solve this problem?我怎么解决这个问题?
Just give your terminal an accessibility access.只需为您的终端提供无障碍访问权限即可。
I'm running MacOs Catalina, and this worked for me.我正在运行 MacOs Catalina,这对我有用。
Go to settings -> Security and Privacy -> Privacy Tab -> Accessibility
, and finally check your terminal进入settings -> Security and Privacy -> Privacy Tab -> Accessibility
,最后检查你的终端
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.