OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'

Jose Isaias Cabrera jicman@outlook.com
Mon Feb 20 20:17:17 GMT 2023

On Monday, February 20, 2023 01:57 PM, Henry S. Thompson  expressed:
> First thing to find out if it's truly broken, or just not known to
> work.
> With a _safe_ test case, just try editting the code to allow Cygwin,
> e.g. on line 121 of keyboard/__init__.py:
> if _platform.system() in ['Windows','CYGWIN_NT-10.0-19044']:

This one failed:
$ python3
Python 3.9.10 (main, Jan 20 2022, 21:37:52)
[GCC 11.2.0] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyboard
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 122, in <module>
    from. import _winkeyboard as _os_keyboard
  File "/usr/local/lib/python3.9/site-packages/keyboard/_winkeyboard.py", line 37, in <module>
    kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
AttributeError: module 'ctypes' has no attribute 'WinDLL'

The linux one worked, but...
    if keyboard.is_pressed("a"):
  File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 410, in is_pressed
  File "/usr/local/lib/python3.9/site-packages/keyboard/_generic.py", line 35, in start_if_necessary
  File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 196, in init
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixkeyboard.py", line 113, in init
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixkeyboard.py", line 109, in build_device
  File "/usr/local/lib/python3.9/site-packages/keyboard/_nixcommon.py", line 174, in ensure_root
    raise ImportError('You must be root to use this library on linux.')
ImportError: You must be root to use this library on linux.

More work to be done. 

> One way or the other, you should find out what the _real_ problem is.

Let's see how far I can go. All I want is to capture the ENTER key in a website powered by python3. Thanks for the ideas.

More information about the Cygwin mailing list