keyerror message when running automation script

Asked by mohammed ahmed on 2019-08-06

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):
                myImages = imagerepository()

****image repository*****
from sikuli.Sikuli import *
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)

class imagerepository():

    imgDict = {}
    def __init__(self):
        self.imgDict = {}
        self.addImage("ok servername","1564497875916.png")

    def addImage(self, name, img):
  self.imgDict[name] = img

    def getImage1(self, name):
  return self.imgDict[name]

[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\", line 11, in <module> class PSWTest(): File "C:\Users\mahmed\Documents\sikuli images\PSWTest.sikuli\", line 22, in PSWTest openpsw() File "C:\Users\mahmed\Documents\sikuli images\PSWTest.sikuli\", line 20, in openpsw click(myImages.getImage("open")) File "C:\Users\mahmed\Documents\sikuli images\imagerepository.sikuli\", line 22, in getImage return self.imgDict[name] KeyError: open

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

not a SikuliX problem, since it is self-made Jython code.

Can you help with this problem?

Provide an answer of your own, or ask mohammed ahmed for more information if necessary.

To post a message you must log in.