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

    Status: Open => Answered

RaiMan proposed the following answer:
that is not possible as such with code "included" with execfile().

the possibilities:
--1. pack the execfile() in a try:except: and raise a specific exception (e.g. 
assert False at the place you want to "exit"). This will bring you to the 
except block

import os
script = r"C:\Sikuli\Tests\testFlows\Test.sikuli"
save = getBundlePath()
setBundlePath(script)
try:
    execfile(os.path.join(script, "Test.py")
except AssertionError:
    print "script has exited"
setBundlePath(save)

--2. pack the whole stuff into a def() (e.g. runTest() ) and use return
, where you want to "exit"

import os
script = r"C:\Sikuli\Tests\testFlows\Test.sikuli"
save = getBundlePath()
setBundlePath(script)
execfile(os.path.join(script, "Test.py")
runTest()
setBundlePath(save)


when using option 2, then you could switch totally to using Sikuli's import 
feature. Then you would have as a convenience the automatic image path handling 
on top.

-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to