← Back to team overview

sikuli-driver team mailing list archive

[Question #658655]: Import error : Errors in loading sikuli module

 

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

Hi All,

I am a beginner in python and sikuli. Please help me with the issue.

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

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"

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

readcsvfile()


/SikuliFramework/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]

Error Message:
[Error] stopped
[Error] An error occurs at Line 3
[Error] Error Message:
Traceback (most recent call last):
File "/tmp/sikuli-tmp507743855526457893.py", Line 3, in 
from ImageDictionary import TestImgDict
File "/usr/share/Sikuli/Lib/sikuli/SikuliImporter.py", line 45, in load module
return self._load_module(module_name)
File  "/usr/share/Sikuli/Lib/sikuli/SikuliImporter.py", line 29, in load module
raise ImportError("Errors in loading sikuli module:%s \n%s\n" - HOW TO FIX\ Try adding \"from sikuli import*\" in the module .\n" %(fullname, e))
ImportError : Errors in loading sikuli module: ImageDictionary
mismatched input '\n' expecting DEDENT (ImageDictiomnary.py, line 9)
-How TO fix? Try adding "from sikuli import *" in the module.

I am using Sikuli x-1.0rc3 and in linux debian jessi. 

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