ImportError: No module named sikuli.Sikuli

Asked by Steve Brown

I am getting this error when I run my python script.

ImportError: No module named sikuli.Sikuli

The first lines in my script are

from sikuli.Sikuli import *
import unittest
import HTMLTestRunner

I am on Windows 7 and the path is set to the folder where sikuli-script.jar resides.
I even tried copying sikuli-script.jar into the folder I am running the script from.

Question information

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

--- ... when I run my python script.
What does this mean? How are you running your script?

--- from sikuli.Sikuli import *
if it would be found at all, this is sufficient:
from sikuli import *

If you are not using any of the runner methods, that come with Sikuli (e.g. using plain Jython or PyDev in Eclipse)
--- Sikuli-IDE.bat -r some-name.sikuli
--- Sikuli-IDE-w.bat -r some-name.sikuli
--- java -jar path-to-sikuli-script.jar some-name.sikuli

you have to set up the Python sys.path accordingly, so it contains
path-to-sikuli-script.jar/Lib

Revision history for this message
Steve Brown (sbrown-d) said :
#2

 I got myself up and running using HTMLTestRunner from the information on this post
https://answers.launchpad.net/sikuli/+question/176005

I am now trying to workaround Sikuli's running my test cases in reverse order.
Any suggestions?

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

If you are using Python's unittest module (defining TestCase subclasses and setting up a TestSuite, that is finally run by a TestRunner (HTMLTestRunner in this case), the with in each TestCase the "def testXXX()" are run in alphabetical order).

The problem that tests are run in reverse order as they exist in the script is only in the case you use the IDE's view Unittest (which I think cannot be combined with the HTMLTestRunner).

So again: How do you run your test cases? post an example of your script.

Revision history for this message
Steve Brown (sbrown-d) said :
#4

Thanks, I had a typo - an extra "_" in one of my def statements.

test__ myDef instead of test_myDef