← Back to team overview

sikuli-driver team mailing list archive

[Question #637765]: Sikuli Framework - Issue in using switch statement to perform the actions from different .py file

 

New question #637765 on Sikuli:
https://answers.launchpad.net/sikuli/+question/637765

Hi All,

I have been trying to create an automation framework for Sikuli X-1.Orc3 IDE for my project.  Here is my flow.. 

1. To read data from CSV file
2. Extract the image from the image dictionary
3. With help Keyword extracted from CSV file and Image from the dictionary perform actions in the screen.

Code: 

InputRead.sikuli --> Inputread.py
##############################
import csv
import os
from ImageDictionary import TestImgDict
from Actions import Actions

def readcsvfile():
            try : 
                   mypath = os.path.dirname(getBundlePath())
                   obj1 = Actions()
                   input = open(<CSV path>, 'rb')
                   for line in input.readlines():
                        Field,Keyword,value = line.strip().split('",")
                        print Field,Keyword,value
                        Runresult = obj1.Actions(Field,keyword,value)
                        print Runresult

            except IOError:
                        Print "Input File not Found"
readcsvfile()

ImageDictionary.sikuli --> ImageDictionary.py
################################
Class TestImgDict(object):
            ImgDict = {}

            def __init__(self)
                        self.imgDict = {}
                        self.addImage("LoginName_Txtbox",<Image.png>)

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

Actions.sikuli --> Actions.py
##########################
from ImageDictionary import TestImgDict
import ConfigParser

Class Actions(object):
         def __init__(self):
                  config = ConfigParser.ConfigParser()
                  config.read(<path>)

         def Actions(Field,keyword,value):
                  obj = TestImgDict()
                  return {
                           'Type' : type(obj.getImage(Field),value)
                               }.get(keyword, 'NoValue')

##############################
Error message: 
errors in loading sikuli module %s\%s\n - HOW TO FIX? .......
no viable alternative at input "Type".......

How to fix try adding "from sikuli import * " in the module.

I know missed something in the code.. I have been trying to find the root cause. 

Please help.. Please guide me.. 

Thanks

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.