Using Sikuli to test Python3/PyQt5 on Mac?

Asked by David Cortesi

I am developing an app based on Python 3 and PyQt5, under Mac OS 10.9. I think Sikuli has what I need to test it, but I want to ask some things that are not clear from the tutorial and FAQs.

I see that Sikuli runs in the world of Jython, under Java. This Mac OS has java version "1.6.0_65" installed, also XCode 5.0.2. But when I download Sikuli will it include Jython, or do I need to get that separately?

Within a Sikuli script, will it work to start my app this way:

app = App('my-app-name')
app.open('python3 myapp.py')

In other words, can I start a GUI app by launching the CPython 3 interpreter?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
David Cortesi
Solved:
Last query:
Last reply:
Revision history for this message
David Cortesi (davecortesi) said :
#1

OK I will answer part of my own question: yes, downloading the sikuli setup jar and taking options 1 and 6, sikuli IDE runs nicely. So all is included.

However it is not clear where the command-line ability went. "which sikuli" produces nothing and there doesn't seem to be anything named sikuli* in /usr.

As to launching a python program, the statement app.open(...) fails with the error,

App.open failed: /usr/local/bin/python /Users/dcortes1/Dropbox/David/PPQT/V2/ppqt/Tests/editview_test2.py not found

Both of these files (/usr/local/bin/python, and /Users.../Tests/editview_test2.py) do exist.

Revision history for this message
David Cortesi (davecortesi) said :
#2

OK now I will answer some more of my initial question: the command line is documented here:
http://doc.sikuli.org/faq/010-command-line.html

Still an open question: how to create and launch and App based on a CPython3 program.

Revision history for this message
David Cortesi (davecortesi) said :
#3

Further about that: the documentation linked above is incorrect for Mac OS X.
The correct command line to start sikuli is:

  /Applications/SikuliX-IDE.app/Contents/runIDE

To run an existing script and report success or error,

  /Applications/SikuliX-IDE.app/Contents/runIDE -r path-to-script.sikuli

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

@ comment #3
good finding. the docs are for RC3 and not yet up to date.

your App.open() problem: on Mac the internal implementation does not allow to use any files with an associated app, that should open them.

You might try with
run("open your_stuff.py")

Revision history for this message
David Cortesi (davecortesi) said :
#5

Thank you for the reply. Using run() command in the script does not work because as the doc. says, it "executes the command and the script waits for its completion." So it does start my python program, which comes up, but the script does nothing until the app terminates. Then of course there is no window to find any more.

However! Using subprocess.popen() does work: the app starts, its stdout comes out in the sikuli IDE msg window, and the rest of the script runs.

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

absolutely right.

You found the solution.