Question #230510 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/230510

Mark Weisler posted a new comment:
The working script below illustrates some of how sys.exc_info works.

# script: sys.exc_info explorer
# Mark Weisler
# 11 June 2013
# our goal is to create an error condition, save error to a variable or a 
database
# Sikuli version  X-1.0rc3 on OS X 10.6.8

try:
    f = open('sometestfile2.txt', 'r')    # make sure this file does not exist 
to trigger an error, which we want to do
    f.close()   # just in case the file did exist
except:
    # some code maybe here
    print "Got an exception:", sys.exc_info()[0], " --- saying:", 
sys.exc_info()[1]
    print "0 is: ", sys.exc_info()[0]
    print "1 is: ", sys.exc_info()[1]
    ErrMsg = sys.exc_info()[1]
    print "ErrMsg is: ", ErrMsg  # could be logged or stored in a database

print "Finishing execution..."

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to