How to import the sikuli module in python?

对着背影说爱祢 提交于 2019-12-22 09:03:51

问题


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


回答1:


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

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



来源:https://stackoverflow.com/questions/10583682/how-to-import-the-sikuli-module-in-python

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!