【发布时间】:2022-01-19 21:07:09
【问题描述】:
我正在制作一个机器人,它有一个名为get_members() 的方法,它需要两个参数self and client。我提供了两个参数,但它仍然说我提供了 3 个参数。
客户端参数也显示警告Unexpected Argument
堆栈跟踪
Traceback (most recent call last):
File "C:\Users\Vinesh\Documents\GitHub\DMBot\lib\scraper.py", line 18, in fetch
self.scrape()
File "C:\Users\Vinesh\Documents\GitHub\DMBot\lib\scraper.py", line 14, in scrape
self.scraped = self.get_members(self, client)
TypeError: get_members() takes 2 positional arguments but 3 were given
During handling of the above exception, another exception occurred:
【问题讨论】:
-
请检查How to Ask。发布您的代码 - minimal reproducible example.
-
您没有传递
self参数。它为对象方法隐式传递。所以,只需使用self.get_members(client)。
标签: python discord bots discum