SavinaRoja / PyUserInput

A module for cross-platform control of the mouse and keyboard in python that is simple to install and use.
GNU General Public License v3.0
1.07k stars 244 forks source link

k.type_string doesn't accept a newline char #116

Closed parkerlreed closed 5 years ago

parkerlreed commented 5 years ago

The text input worked fine but the newline at the end threw an error. Linux.

[parker@stealth bin]$ python bar-scoket.py 
[+] Listening for connections on port: 2222
[+] Client connected: 192.168.0.179
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "bar-scoket.py", line 24, in run
    k.type_string(re.sub(r".*plr", "", self.data.replace('\r', '')))
  File "/usr/lib/python3.7/site-packages/pykeyboard/base.py", line 79, in type_string
    self.tap_key(char)
  File "/usr/lib/python3.7/site-packages/pykeyboard/base.py", line 43, in tap_key
    self.press_key(character)
  File "/usr/lib/python3.7/site-packages/pykeyboard/x11.py", line 76, in press_key
    self._handle_key(character, X.KeyPress)
  File "/usr/lib/python3.7/site-packages/pykeyboard/x11.py", line 68, in _handle_key
    keycode = self.lookup_character_keycode(character)
  File "/usr/lib/python3.7/site-packages/pykeyboard/x11.py", line 201, in lookup_character_keycode
    keysym = Xlib.XK.string_to_keysym(KEYSYMS[character])
KeyError: '\n'

vvv--- sent via xlib
ggfgg
parkerlreed commented 5 years ago

I see this is the old repo.