sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #24878
Re: [Question #245665]: Logging the errors and failures in a seperate file with line numbers where it is failed
Question #245665 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/245665
Status: Open => Answered
obiwan-92 proposed the following answer:
Hello.
Of course.
Well, I'm not sure, how to begin...
The point of this script is to launch a list of script a NB number of times (10 times, here).
Even if one of the script failed, it will call the next one.
It's why when we call the script, we are in a try except.
If the script two possibilities :
First we are in a FindFailed exception.
That's mean that some image was not found by Sikuli.
In this case I save the time in the variable t2 (with the variable t1, it will give me the execution time).
The variable Err contains the catch exception.
It will give me why the script failed.
After I extract from the system information, the pile of the crashed.
In this object I have 4 properties, the two who interesting me are the file and the line of the crash (ferr and lerr)
When the ferr is matching with the name of the script I called, I know I found he right exception so I set the msg variable with the error line and the name file.
Then I log the message in the file (the log function).
If it's not a Findfailed, I try to catch the BaseException who contains approximately all the Python exception.
And I do the same.
Clearly, it's not a simple code in Python.
Don't hesitate to ask, if there is something who trouble you. :)
Best regards.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.