-1

I am making a bot and it has a method in it called get_members() which takes 2 args self and client. I am supplying both arguments and still it says I am providing 3 args.

Also the client parameter shows a warning Unexpected Argument

The stacktrace

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:

3 Answers3

3

self cannot be passed by you. It is passed implicitly by Python.

self.get_members(client)
2

You are passing the self argument when are calling the method, python already acknowledge the self argument, you dont need to pass again, so you code should be:

self.scraped = self.get_members(client)

if your client is inside your class you need to pass the self argument on your client. So you code will be:

self.scraped = self.get_members(self.client)
Lucas Campos
  • 98
  • 1
  • 7
1

You have to remove the first argument self, since get_members is already a method, self it is already passed implicitly when you call it, so you need to do: self.get_members(client)

ac23
  • 81
  • 1
  • 1
  • 5