Can Sikuli-IDE.exe return an error code ?

Asked by v2alex

Hi,
I call: raise SyntaxError, "Bad syntax" from inside a Sikuli script but the framework catches it then forces me to click on a pop up and finally returns an error code of 0. Is there a way for me to run the script and have it not catch the exception and just return an error code ?
Thanks
A.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
v2alex
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

have you tried to use exit(some-value) instead of raise ...?

Revision history for this message
RaiMan (raimund-hocke) said :
#2

--- put your code in a try: except: construct:

try:
   ....
   # some code
   ...
   raise SyntaxError "Bad Syntax"
   ...
   # some code
except SyntaxError:
   exit(a-value-not-zero)

--- Another possibility:

def syntaxError(type):
    #evaluate type
    exit(a-value-not-zero)

# some code
if condition-that-is-a-syntax-error:
    syntaxError(a-value)
# more code

Revision history for this message
v2alex (alex-lukish) said :
#3

Done