← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #286612]: run .py file in sikuli

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Congrats !! one step further to scripting championship ;-)

... You packed another small bug this time as well
which one ???

... Do you think this is a good approach?
Yes it is. The Python scripts start up with very little delay and you might directly inspect the resulting output to stdout, that is produced by your Python script (content of result in the above sample).
On top you might exit the Python script with a return code, that is mentioned in the first line of result.

this is how you might access the content of result in your SikuliX
script:

resultLines = result.split("\n") # get the output as list of strings - one per line
returnCode = int(resultLines[0].strip()) # get the return code as number

# scan the output lines
for line in resultLines[1:]: 
    print line.strip()

the function strip() removes leading and trailing whitespace from the
given string

All the best

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.