public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
@ 2023-02-20 18:04 Jose Isaias Cabrera
  2023-02-20 18:57 ` Henry S. Thompson
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-20 18:04 UTC (permalink / raw)
  To: Jim Garrison via Cygwin


Greetings.

Python 3 apparently does not support the python keyboard library in Cygwin:

$ 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 128, in <module>
    raise OSError("Unsupported platform '{}'".format(_platform.system()))
OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
>>>

Any ideas on how I can make this work?  Thanks.

josé

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 18:04 OSError: Unsupported platform 'CYGWIN_NT-10.0-19044' Jose Isaias Cabrera
@ 2023-02-20 18:57 ` Henry S. Thompson
  2023-02-20 20:17   ` Jose Isaias Cabrera
  2023-02-20 18:58 ` Marco Atzeri
  2023-02-22 16:54 ` Brian Inglis
  2 siblings, 1 reply; 14+ messages in thread
From: Henry S. Thompson @ 2023-02-20 18:57 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: Jim Garrison via Cygwin

Jose Isaias Cabrera via Cygwin writes:

>   File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 128, in <module>
>     raise OSError("Unsupported platform '{}'".format(_platform.system()))
> OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
>>>>
>
> Any ideas on how I can make this work?  Thanks.

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']:

If that doesn't work, try a similar edit on line 123.

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

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                       URL: http://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 18:04 OSError: Unsupported platform 'CYGWIN_NT-10.0-19044' Jose Isaias Cabrera
  2023-02-20 18:57 ` Henry S. Thompson
@ 2023-02-20 18:58 ` Marco Atzeri
  2023-02-20 19:31   ` Jose Isaias Cabrera
  2023-02-22 16:54 ` Brian Inglis
  2 siblings, 1 reply; 14+ messages in thread
From: Marco Atzeri @ 2023-02-20 18:58 UTC (permalink / raw)
  To: cygwin

On 20.02.2023 19:04, Jose Isaias Cabrera via Cygwin wrote:
> 
> Greetings.
> 
> Python 3 apparently does not support the python keyboard library in Cygwin:
> 
> $ 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 128, in <module>
                 ^^^^

it is your own build


>      raise OSError("Unsupported platform '{}'".format(_platform.system()))
> OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
>>>>
> 
> Any ideas on how I can make this work?  Thanks.
> 
> josé
> 

I assume you are installing

    https://pypi.org/project/keyboard/

and it seems requires dedicated HDW interfaces
   "Works with Windows and Linux (requires sudo), with experimental OS X 
  support"


So you are on your own

Regards
Marco





^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 18:58 ` Marco Atzeri
@ 2023-02-20 19:31   ` Jose Isaias Cabrera
  2023-02-21  7:52     ` Csaba Raduly
  0 siblings, 1 reply; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-20 19:31 UTC (permalink / raw)
  To: cygwin, Marco Atzeri


On Monday, February 20, 2023 01:58 PM, Marco expressed:

> > Traceback (most recent call last):
> >    File "<stdin>", line 1, in <module>
> >    File "/usr/local/lib/python3.9/site-packages/keyboard/__init__.py", line 128, in <module>
>              ^^^^
> it is your own build

Well, this is not part of Cygwin Setup python3's library. So, I installed it using pip3:

$ ls *.whl
keyboard-0.13.5-py3-none-any.whl*

$ pip3 install keyboard-0.13.5-py3-none-any.whl

> 
> I assume you are installing
> https://pypi.org/project/keyboard/

Yes.
 
> and it seems requires dedicated HDW interfaces
> "Works with Windows and Linux (requires sudo), with experimental OS X
> support"
> 
> So you are on your own

It says it works with Windows, why am I on my own?  It should work.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 18:57 ` Henry S. Thompson
@ 2023-02-20 20:17   ` Jose Isaias Cabrera
  2023-02-20 20:48     ` Henry S. Thompson
  0 siblings, 1 reply; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-20 20:17 UTC (permalink / raw)
  To: Henry S. Thompson; +Cc: Jim Garrison via Cygwin


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
    _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 109, in build_device
    ensure_root()
  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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 20:17   ` Jose Isaias Cabrera
@ 2023-02-20 20:48     ` Henry S. Thompson
  2023-02-20 21:41       ` Jose Isaias Cabrera
  0 siblings, 1 reply; 14+ messages in thread
From: Henry S. Thompson @ 2023-02-20 20:48 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: Jim Garrison via Cygwin

Jose Isaias Cabrera writes:

> ...
>   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.

Two things to try:
 1) Run python from an elevated shell (unlikely to make a difference);
 2) Same strategy -- edit _nixcommon.py to always return true from
    ensure_root.

Good luck,

ht
-- 
       Henry S. Thompson, School of Informatics, University of Edinburgh
      10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
                Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
                       URL: http://www.ltg.ed.ac.uk/~ht/
 [mail from me _always_ has a .sig like this -- mail without it is forged spam]

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 20:48     ` Henry S. Thompson
@ 2023-02-20 21:41       ` Jose Isaias Cabrera
  2023-02-20 23:13         ` Eliot Moss
  0 siblings, 1 reply; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-20 21:41 UTC (permalink / raw)
  To: Henry S. Thompson; +Cc: Jim Garrison via Cygwin


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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 21:41       ` Jose Isaias Cabrera
@ 2023-02-20 23:13         ` Eliot Moss
  0 siblings, 0 replies; 14+ messages in thread
From: Eliot Moss @ 2023-02-20 23:13 UTC (permalink / raw)
  To: Jose Isaias Cabrera, Henry S. Thompson; +Cc: Jim Garrison via Cygwin

If you will be running X (and Cygwin supports, but does not require that),
then the xorg backend (meaning: not the Windows one) with pynput (note, that
package has no "i" in its name) may achieve your goal.

Regards - Eliot Moss

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 19:31   ` Jose Isaias Cabrera
@ 2023-02-21  7:52     ` Csaba Raduly
  2023-02-21 20:03       ` Jose Isaias Cabrera
  0 siblings, 1 reply; 14+ messages in thread
From: Csaba Raduly @ 2023-02-21  7:52 UTC (permalink / raw)
  To: Jose Isaias Cabrera; +Cc: cygwin, Marco Atzeri

On Mon, 20 Feb 2023 at 20:32, Jose Isaias Cabrera via Cygwin wrote:
>
> It says it works with Windows, why am I on my own?  It should work.
>

Because you're not on Windows. You're on Cygwin, which acts as a POSIX
(Unix-like) system.

If you want Python *on Windows*, start here:
https://www.python.org/downloads/windows/

Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-21  7:52     ` Csaba Raduly
@ 2023-02-21 20:03       ` Jose Isaias Cabrera
  2023-02-21 20:52         ` Eliot Moss
  0 siblings, 1 reply; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-21 20:03 UTC (permalink / raw)
  To: cygwin


On February 21, 2023 2:52 AM, Csaba Raduly  expressed:

> Because you're not on Windows. You're on Cygwin, which acts as a POSIX
> (Unix-like) system.

Wow! Thanks for that deep thought. :-) I knew that. :-) I have been using Cygwin since 1999 (sometimes more than others). I just thought that by now, Windows would have started playing nicer and had made enough changes to be friendlier to POSIX. Long story, but I need to use Cygwin for this. Thanks, though.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-21 20:03       ` Jose Isaias Cabrera
@ 2023-02-21 20:52         ` Eliot Moss
  2023-02-22 15:56           ` Brian Inglis
  0 siblings, 1 reply; 14+ messages in thread
From: Eliot Moss @ 2023-02-21 20:52 UTC (permalink / raw)
  To: Jose Isaias Cabrera, cygwin

On 2/22/2023 7:03 AM, Jose Isaias Cabrera via Cygwin wrote:
> 
> On February 21, 2023 2:52 AM, Csaba Raduly  expressed:
> 
>> Because you're not on Windows. You're on Cygwin, which acts as a POSIX
>> (Unix-like) system.
> 
> Wow! Thanks for that deep thought. :-) I knew that. :-) I have been using Cygwin since 1999 (sometimes more than others). I just thought that by now, Windows would have started playing nicer and had made enough changes to be friendlier to POSIX. Long story, but I need to use Cygwin for this. Thanks, though.

Sorry - hard to know whether one is dealing with a "newbie" or not.

EM

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-21 20:52         ` Eliot Moss
@ 2023-02-22 15:56           ` Brian Inglis
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Inglis @ 2023-02-22 15:56 UTC (permalink / raw)
  To: cygwin

On 2023-02-21 13:52, Eliot Moss via Cygwin wrote:
> On 2/22/2023 7:03 AM, Jose Isaias Cabrera via Cygwin wrote:
>>
>> On February 21, 2023 2:52 AM, Csaba Raduly  expressed:
>>
>>> Because you're not on Windows. You're on Cygwin, which acts as a POSIX
>>> (Unix-like) system.
>>
>> Wow! Thanks for that deep thought. :-) I knew that. :-) I have been using 
>> Cygwin since 1999 (sometimes more than others). I just thought that by now, 
>> Windows would have started playing nicer and had made enough changes to be 
>> friendlier to POSIX. Long story, but I need to use Cygwin for this. Thanks, 
>> though.

> Sorry - hard to know whether one is dealing with a "newbie" or not.

In Thunderbird, I sort by "Correspondents" and see he has been posting since at 
least 2019, you can also search "From, To, Cc, Bcc" or similar for the surname, 
and on the web e.g.

	https://inbox.sourceware.org/cygwin/?q=Cabrera&o=-1

shows 1998 - earlier than even he remembers ;^>

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-20 18:04 OSError: Unsupported platform 'CYGWIN_NT-10.0-19044' Jose Isaias Cabrera
  2023-02-20 18:57 ` Henry S. Thompson
  2023-02-20 18:58 ` Marco Atzeri
@ 2023-02-22 16:54 ` Brian Inglis
  2023-02-22 18:06   ` Jose Isaias Cabrera
  2 siblings, 1 reply; 14+ messages in thread
From: Brian Inglis @ 2023-02-22 16:54 UTC (permalink / raw)
  To: cygwin

On 2023-02-20 11:04, Jose Isaias Cabrera via Cygwin wrote:
> Python 3 apparently does not support the python keyboard library in Cygwin:
> $ 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 128, in <module>
>      raise OSError("Unsupported platform '{}'".format(_platform.system()))
> OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
>>>>
> Any ideas on how I can make this work?

Post a bug that given the script runs in python, it works and is supported!
You may want to mention that uname -m (ARCH) and -o (Cygwin) are the safe 
options, -p and -i are optional, and uname -s may contain unexpected qualifiers 
(like Windows version and patch).
Perhaps on Cygwin platform.system() should return uname -o instead of -s?

If you want to try and fix it you could have it use a regex or a different 
method and make it work like some generic POSIX API platform:

	https://docs.python.org/3/library/platform.html

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                 -- Antoine de Saint-Exupéry

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: OSError: Unsupported platform 'CYGWIN_NT-10.0-19044'
  2023-02-22 16:54 ` Brian Inglis
@ 2023-02-22 18:06   ` Jose Isaias Cabrera
  0 siblings, 0 replies; 14+ messages in thread
From: Jose Isaias Cabrera @ 2023-02-22 18:06 UTC (permalink / raw)
  To: cygwin; +Cc: Brian Inglis

On Wednesday, February 22, 2023 10:56 AM, Brian Inglis expressed:

> shows 1998 - earlier than even he remembers ;^>

Well, my apologies. I knew I was close. And I even thought to put 1998, but when I went to my email, I only found some for 1999. And because I like facts, thus, 1999. :-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-02-22 18:06 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 18:04 OSError: Unsupported platform 'CYGWIN_NT-10.0-19044' Jose Isaias Cabrera
2023-02-20 18:57 ` Henry S. Thompson
2023-02-20 20:17   ` Jose Isaias Cabrera
2023-02-20 20:48     ` Henry S. Thompson
2023-02-20 21:41       ` Jose Isaias Cabrera
2023-02-20 23:13         ` Eliot Moss
2023-02-20 18:58 ` Marco Atzeri
2023-02-20 19:31   ` Jose Isaias Cabrera
2023-02-21  7:52     ` Csaba Raduly
2023-02-21 20:03       ` Jose Isaias Cabrera
2023-02-21 20:52         ` Eliot Moss
2023-02-22 15:56           ` Brian Inglis
2023-02-22 16:54 ` Brian Inglis
2023-02-22 18:06   ` Jose Isaias Cabrera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).