How to get the image file name when a FindFailed exception happen

Asked by Stranger

I want to get the image file name not found by region.find() when a FindFailed exception happens in my Python construct try: ... except: ... .
could you tell how to get the file name, I need to know it and print into my log

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Stranger
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

Try this codes.

import os.path
Settings.UserLogs = True
Debug.setUserLogFile(os.path.join(getBundlePath(),"log.txt"))
try:
    find("1502972319179.png")
except FindFailed, e:
    logtxt = "%s" % e
    Debug.user(logtxt)

Revision history for this message
Stranger (peterlee007) said :
#2

Thank you. Paste your codes, it is resolved.