Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Treat error ?
#1
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)
Reply


Messages In This Thread
Treat error ? - by JohnnyCoffee - Apr-14-2020, 07:16 PM
RE: Treat error ? - by buran - Apr-14-2020, 07:49 PM
RE: Treat error ? - by JohnnyCoffee - Apr-14-2020, 11:39 PM
RE: Treat error ? - by buran - Apr-15-2020, 05:02 PM
RE: Treat error ? - by JohnnyCoffee - Apr-16-2020, 10:28 AM
RE: Treat error ? - by buran - Apr-16-2020, 11:40 AM
RE: Treat error ? - by JohnnyCoffee - Apr-16-2020, 11:23 PM
RE: Treat error ? - by buran - Apr-17-2020, 03:01 AM
RE: Treat error ? - by JohnnyCoffee - Apr-17-2020, 05:54 AM
RE: Treat error ? - by buran - Apr-17-2020, 07:30 AM
RE: Treat error ? - by JohnnyCoffee - Apr-17-2020, 07:35 AM
RE: Treat error ? - by buran - Apr-17-2020, 07:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to treat two token as one token(lexer)? hsunteik 1 3,589 Dec-28-2016, 12:26 AM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020