TanGentleman / KeyMaster

A comprehensive toolkit for python classes and easy to use scripts for logging, analyzing, and simulating keystrokes.
MIT License
1 stars 0 forks source link

Some unicode characters tripping encode_keycode_char #35

Closed TanGentleman closed 10 months ago

TanGentleman commented 10 months ago

ValueError: encode_keycode_char: Key length != 1 An error occurred: encode_keycode_char: Key length != 1 Listener stopped! Warning: validate_keystrokes: Lengths not equal. Input string found extra char at index 11: ¨ <- 11 Keystrokes validated: False Log not created. Log had trouble saving!

TanGentleman commented 10 months ago

Narrowed it down:

An error occurred: WEIRD KEY: ¨¥, len: 2

Turns out that in the pynput library, a KeyCode.char value can hold a string like "¨¥" when I type these characters very quickly together or simultaneously.

Replicated by:

cd KeyMaster
python
from client.configurate import Config
config = Config()
config.listen_script()

I then mashed unicode characters, resulting in a 2-character string equivalent to: "¨" + "¥" causing a ValueError.