1

The message refers to the line if self.find_action(self, bit) is not None:

If I run I get the error: TypeError: find_action() takes 2 positional arguments but 3 were given

def find_action(self, search_term):
    for action in self.actions:
        bits = re.split(";", action)
        for bit in bits:
            if bit == search_term:
                return action
    return None

def check_action_free(self, params):
    bits = re.split(";", params)
    for bit in bits:
        if self.find_action(self, bit) is not None:
            return False
    return True
Tel Monks
  • 11
  • 2
  • 6
    The call to "find_action" should not pass "self" as an argument (I'm assuming these are both methods in some class). – Mark Lavin Dec 05 '21 at 19:21
  • And [here is why](https://stackoverflow.com/questions/2709821/what-is-the-purpose-of-the-word-self#:~:text=Python%20decided%20to%20do%20methods%20in%20a%20way%20that%20makes%20the%20instance%20to%20which%20the%20method%20belongs%20be%20passed%20automatically). – Zegarek Dec 05 '21 at 19:39
  • Thanks to both. That was the answer, although I am still digesting the explanation that Zigarek sent. – Tel Monks Dec 05 '21 at 20:19

0 Answers0