nahilaChowdhury / shiny-octo-succotash

0 stars 0 forks source link

function error #8

Open nahilaChowdhury opened 4 years ago

nahilaChowdhury commented 4 years ago

@WK-GiHu

Would you mind telling me the issue?

It says that it is missing one positional argument however, I think i put it in?

https://github.com/nahilaChowdhury/shiny-octo-succotash/blob/41ef60b4267d2a9a5d650c83c9c0999570abf912/Mark%20Analysis%202#L351

this is the error it gives: return self.func(*args) TypeError: get_students_by_name() missing 1 required positional argument: 'last'

WK-GiHu commented 4 years ago

@nahilaChowdhury

TypeError: get_students_by_name() missing 1 required positional argument: 'last'

The function def get_students_by_name(... https://github.com/nahilaChowdhury/shiny-octo-succotash/blob/41ef60b4267d2a9a5d650c83c9c0999570abf912/Mark%20Analysis%202#L351 is a class method, thererfore the first argument have to be self.

Now, as you use self.firstname you don't need the arguments (first, last). Change to

def get_students_by_name(self):

and the function definition matches the command definition

command = self.get_students_by_name

which is without additional arguments.

Read up on Python - Object Oriented