How can I avoid TypeError: MouseSwitch() missing 8 required positional arguments: 'msg', 'x', 'y', 'data', 'time', 'hwnd', and 'window_name'

前端 未结 2 977
遇见更好的自我
遇见更好的自我 2021-01-03 06:34

Trying to hook into mouse events but in my early tests the program stops responding after about 30 seconds[EDIT: See bottom of post] and gives this error

2条回答
  •  太阳男子
    2021-01-03 07:35

    I had this with KeyboardSwitch instead of MouseSwitch and traced it to a UnicodeDecodeError when pyHook tries to interpret the window name as ascii. It fails on Skype which has unicode characters in its window name. I've posted how I fixed it here. But I had to rebuild pyHook.

提交回复
热议问题