sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #52286
[Question #682622]: keyerror message when running automation script
New question #682622 on Sikuli:
https://answers.launchpad.net/sikuli/+question/682622
from sikuli.Sikuli import *
import os
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
from imagerepository import *
from imageclick import *
#from util import *
#from regionDictionary import *
class PSWTest():
def openpsw():
#def __init__(self):
#try
myImages = imagerepository()
Debug.on(3)
app=App.open(r"C:\xxxx\Mxxxxxer\System\ftmerfr.exe")
wait(5)
click(myImages.getImage("open"))
#click(myImages.getImage('open'))
openpsw()
****image repository*****
from sikuli.Sikuli import *
myPath = os.path.dirname(getBundlePath())
getImagePath()
if not myPath in sys.path: sys.path.append(myPath)
class imagerepository():
imgDict = {}
def __init__(self):
self.imgDict = {}
self.addImage("open","1565006145909.png")
self.addImage("addserver","1565006209232.png")
self.addImage("servername","1564497837198.png")
self.addImage("ok servername","1564497875916.png")
self.addImage("startservice","1564497937218.png")
self.addImage("stopservice","1564497991603.png")
def addImage(self, name, img):
self.imgDict[name] = img
def getImage1(self, name):
return self.imgDict[name]
****error***
[error] script [ PSWTest ] stopped with error at line --unknown--
[error] Error caused by: Traceback (most recent call last): File "C:\Users\mahmed\Documents\sikuli images\PSWTest.sikuli\PSWTest.py", line 11, in <module> class PSWTest(): File "C:\Users\mahmed\Documents\sikuli images\PSWTest.sikuli\PSWTest.py", line 22, in PSWTest openpsw() File "C:\Users\mahmed\Documents\sikuli images\PSWTest.sikuli\PSWTest.py", line 20, in openpsw click(myImages.getImage("open")) File "C:\Users\mahmed\Documents\sikuli images\imagerepository.sikuli\imagerepository.py", line 22, in getImage return self.imgDict[name] KeyError: open
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.