put a variable as text into a Debug.log("image not found %", xyz); What are the exit() parameters?

Asked by eduardobedoya

Hi all, Im using this code...

try:
    reg.click(Image)
except
    App.setClipboard("image not found")
    exit()

I would like to write in the Sikuli IDE log "image not found" + somevariable
Currently Im using
Debug.log("image not found %", xyz)
where xyz = somevariable
but when I run it I get this error
[error] java.util.FormatFlagsConversionMismatchException ( java.util.FormatFlagsConversionMismatchException: Conversion = e, Flags = )
How can I put a variable value (or the clipboard content instead) in a SIkuli IDE log???? Thanks Advanced

and please I would like to know what are exit() parameters??
I've tried to read about that from here with no clue http://doc.sikuli.org/globals.html
it seems that are numbers? like 1??

Thanks Advanced.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene S
Solved:
Last query:
Last reply:
Revision history for this message
Best Eugene S (shragovich) said :
#1

You have to specify the format of the variable you are using after the "%" specifier.

Have a look here for a full list of format types:
https://docs.python.org/2/library/stdtypes.html#string-formatting-operations

In you case that could be:

xyz="somestring"
Debug.log("image not found %s", xyz)

so since "xyz" a string here, you specify that by using "%s"

Revision history for this message
Eugene S (shragovich) said :
#2

The numbers that can be used inside exit() calls are the exit codes.

For example:
exit(0) means a clean exit without any errors / problems
exit(1) means there was some issue / error / problem and that is why the program is exiting.

This is not a Sikuli specific feature and is pretty common. A non-zero exit code is treated as an abnormal exit and the error code indicates what was the problem. A zero error code means a successful exit.

This is useful for other programs, shell, caller etc. to know what happened with your program and proceed accordingly.

Revision history for this message
eduardobedoya (gonnabdh) said :
#3

Thanks Eugene S, that solved my question.