On Monday, February 20, 2023 03:48 PM, Henry S. Thompson  expressed:

> Two things to try:
> 1) Run python from an elevated shell (unlikely to make a difference);

This was the easy part. :-) Same issue.

> 2) Same strategy -- edit _nixcommon.py to always return true from
> ensure_root.

Now, it's getting a little deeper, but I will try this again tomorrow.

$ cat chkKBoard.py
#!/usr/bin/python3
import keyboard
while True:
    if keyboard.is_pressed("a"):
        print("You pressed 'a'.")
        break

$ ./chkKBoard.py
/usr/local/lib/python3.9/site-packages/keyboard/_nixkeyboard.py:110: 
UserWarning: Failed to create a device file using `uinput` module. Sending of 
events may be limited or unavailable depending on plugged-in devices.
  device = aggregate_devices('kbd')
Traceback (most recent call last):
  File "/home/E608313/./chkKBoard.py", line 4, in <module>
    if keyboard.is_pressed("a"):
  File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 410, 
in is_pressed
    _listener.start_if_necessary()
  File "/usr/local/lib/python3.9/site-packages/keyboard/_generic.py", line 35, 
in start_if_necessary
    self.init()
  File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 196, 
in init
    _os_keyboard.init()
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixkeyboard.py", line 
113, in init
    build_device()
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixkeyboard.py", line 
110, in build_device
    device = aggregate_devices('kbd')
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixcommon.py", line 
168, in aggregate_devices
    assert fake_device
AssertionError

This is tomorrow's problem. Can't work tomorrow's problem today. :-) Thanks for 
the ideas.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to