我遇到了以下错误,你知道是什么引起的吗
Traceback (most recent call last):
File "test.py", line 42, in <module>
click_thread = RegisterC(delay, button)
File "C:\Users\pc\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 781, in __init__
assert group is None, "group argument must be None for now"
AssertionError: group argument must be None for now
delay = 0.01
button = Button.left
start_stop_key = KeyCode(char='w')
exit_key = KeyCode(char='s')
class RegisterC(threading.Thread):
def init(self, delay, button):
super(RegisterC, self).init()
self.delay = delay
self.button = button
self.running = False
self.program_running = True
def start_clicking(self):
self.running = True
def stop_clicking(self):
self.running = False
def exit(self):
self.stop_clicking()
self.program_running = False
def run(self):
while self.program_running:
while self.running:
mouse.click(self.button)
time.sleep(random.uniform(20,60))
time.sleep(0.1)
mouse = MouseController()
keyboard = KeyboardController()
click_thread = RegisterC(delay, button)
click_thread.start()
对象初始化期间调用的神奇方法是
__init__
而不是init
,您需要应用此修复程序:在调用方法
init
时,没有覆盖基类构造函数,因此在这一行click_thread = RegisterC(delay, button)
上给RegisterC
的参数被传递给了Thread.__init__
,它期望group
作为第一个参数,并将其断言为None
相关问题 更多 >
编程相关推荐