moses-palmer / pynput

Sends virtual input commands
GNU Lesser General Public License v3.0
1.77k stars 245 forks source link

Typing Cree Character "ᔨ" returns an invalid key error #465

Closed JeSuisJulien closed 2 years ago

JeSuisJulien commented 2 years ago

This issue is similar to the one here (https://github.com/moses-palmer/pynput/issues/94), only that one seems to have been solved as of verion 1.7 (though my Python literacy isn't good enough to understand how). I am using version 1.7.6 and still get this error. I include a full copy-paste of the error below. Note that it is complicated by the fact that, in my code, calling pynput is triggered by pressing a button in a TKinter window.

Another interesting thing to notice is that other cree characters that have lower unicode hex codes seem to work just fine, like even the character "ᔦ". It seems to me that pynput has support for unicode characters potentially up untill a very specific max unicode hex?

Is there an easy way to get around this? Thanks very much to anyone who tries to help!

Here is the full error message

runfile('/home/julien/Projets/Informatique/PycharmProjects/Clavier Virtuel/Clavier Virtuel Cri Limité R0.py', wdir='/home/julien/Projets/Informatique/PycharmProjects/Clavier Virtuel') Exception in Tkinter callback Traceback (most recent call last): File "/home/julien/anaconda3/lib/python3.8/tkinter/init.py", line 1892, in call return self.func(*args) File "/home/julien/Projets/Informatique/PycharmProjects/Clavier Virtuel/Clavier Virtuel Cri Limité R0.py", line 120, in command = lambda x = bouton : tapper(x) File "/home/julien/Projets/Informatique/PycharmProjects/Clavier Virtuel/Clavier Virtuel Cri Limité R0.py", line 77, in tapper clavier.release(valeur) File "/home/julien/anaconda3/lib/python3.8/site-packages/pynput/keyboard/_base.py", line 427, in release self._handle(resolved, False) File "/home/julien/anaconda3/lib/python3.8/site-packages/pynput/keyboard/_xorg.py", line 236, in _handle raise self.InvalidKeyException(key) pynput.keyboard._base.Controller.InvalidKeyException: 'ᔨ'

SpecialCharacter commented 2 years ago

I encountered a similar issue when I wanted to print characters from the Glagolitic Supplement (U+1E000..U+1E02F). It gave me two unrelated characters.

SpecialCharacter commented 2 years ago

https://github.com/moses-palmer/pynput/issues/356

moses-palmer commented 2 years ago

Thank you for your report, and I apologise for this late reply.

When using the Xorg backend, and characters not mapped in the current layout are encountered, this library attempts to temporarily remap unused keys with the requested symbol. The symbols can be found here.

Unfortunately, no Cree characters at all seem to have a corresponding X keysym. As far as I know, this means that they cannot be typed, and there is nothing this library can do.

I will close this issue since I think that it cannot be fixed; I you think otherwise, please reopen.