Apr-14-2020, 07:16 PM
The code below checks for the existence of a method belonging to a class. If the method exists it returns me True and if it does not return the following error (AttributeError: type object 'Runcode' has no attribute 'scree'), I tried to deal with (AttributeError) to obtain the result False, being that it persists in the error (AttributeError: type object 'Runcode' has no attribute 'scree'). I know that this error is due to the value of the method that was declared wrong on purpose just to be able to get the Boolean value False, being that I can't get it ?
# Acessar a classe controller e checa a existencia do method : o_metexist = hasattr("Runcode", "scree") try: # Return, dispara o evento de acesso ao method da class importada : print(o_metexist) except AttributeError: # v_false = "False" # print(v_false)