How to import the sikuli module in python?

22,079

It's Jython you can't. http://doc.sikuli.org/devs/system-design.html

edit: updated the link, removed a dead post reference.

Share:
22,079
Admin
Author by

Admin

Updated on July 16, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm having trouble getting sikuli+python unit testing to work, and would be glad for some assistance. I searched the internet far and wide, but haven't anything that worked. My python knowledge is very limited, and I guess that doesn't help...

    I'm using win7 32, sikuli 1.0 rc3 (r905), python 2.7.3

    I'm trying to start running sikuli unit tests through python (not with command line, just as a python script to run with the python gui). I've followed, among others, the instructions shown here: http://sikuli.org/docx/globals.html and here: https://answers.launchpad.net/sikuli/+faq/1804

    my sikuli script (name: slidelyChromeUnitTest2.sikuli) starts like this (the rest doesn't matter becuase it gets stuck on the very first line):

    from sikuli import *
    import unittest
    

    and my python script (name: SikuliTestRunner.py) looks like this:

    import sys
    
    mySikuliPath = "D:\\Program Files\\Sikuli X\\slidelyChromeUnitTest2.sikuli"
    if not mySikuliPath in sys.path: sys.path.append(mySikuliPath)
    
    import slidelyChromeUnitTest2
    

    And what I get when I run the python script is this:

    Traceback (most recent call last): File "D:\Python27\SikuliTestRunner.py", line 6, in import slidelyChromeUnitTest2 File "D:\Program Files\Sikuli X\slidelyChromeUnitTest2.sikuli\slidelyChromeUnitTest2.py", line 1, in from sikuli import * ImportError: No module named sikuli

    And I can't get past that error... What am I doing wrong?

    Thank you, Ilan