Closed w1p1c1 closed 2 years ago
I'm not sure what could be causing that, but I replaced the offending line so it at least doesn't break when this type of unexpected event happens.
If you don't want to wait until the next release, replace line 538 in keyboard/keyboard_winkeyboard.py from
event_type = keyboard_event_types[wParam]
to
event_type = KEY_UP if wParam & 0x01 else KEY_DOWN
By the way, is there something unusual about your setup? Other macro software, emulation, unique hardware or keyboard layout?
Thank you for your reply!Thank you for all you have done for us! It works!The problem is solved! Here i made a simplified program to reproduce the problem:
import pyautogui import time import lackey#Probably lackey caused that error import tkinter as tk import pynput#Include mouse & keyboard
ctr = pynput.keyboard.Controller() def a(): print('a') ctr.type('99') username = 'w1p1c1' password = '1' userinput = input(''username:'') if userinput == username: userinput = input(''password:'') if userinput == password: print('ok') else: print('error') else: print('e')
Ah, so it has probably something to do with how pynput is generating its keyboard events. I'll investigate to see if there's something to be done, but for now I'll close the ticket. Thanks for the bug report and confirmation of the fix.
error in keyboard hook: Traceback:
File "....\lib\site-packages\keyboard_winkeyboard.py",line 538,in low_level_keyboard_handler
event_type = keyboard_event_types[wParam]
OS:windows7 x86
python3.8.9