How to preserve all information of an error when using an error handles

Asked by Ignasi Bernadas

Hellow,

i have implemented an error handler that takes an screenshot when sikuli can not find an image. The problem is that now, all the information that sikuli usualy gives about the class, the function and the line where the error has produced doesn't appear in the logs.

try:
    ClassX.function1()
    ClassX.function2()
    ClassY.function1()
    ClassY.function2()

except FindFailed:
    print sys.exc_info()
    path = getBundlePath() + "\\..\\"
    name = "error.png"
    Common.takeAScreenshot(path,name)

I have found that the command sys.exc_info() gives a part of this information, but not the whole error.

Anyone knows a possible solution?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Evgen (fortotal) said :
#1

This should help:

try:
    ClassX.function1()
    ...

except FindFailed as textoferror:
    print(textoferror)
    ...

See https://docs.python.org/2/tutorial/errors.html for details

Can you help with this problem?

Provide an answer of your own, or ask Ignasi Bernadas for more information if necessary.

To post a message you must log in.