Import error : Errors in loading sikuli module

Asked by Varun Palani

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.

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
RaiMan (raimund-hocke) said :
#1

sorry, but Sikuli x-1.0rc3 is no longer supported.

see http://sikulix.com

... and be sure to have read through the docs, especially:
http://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-other-sikuli-scripts-reuse-code-and-images

Revision history for this message
Varun Palani (varun52mit) said :
#2

Thanks Raiman.. I will upgrade the Sikuli..

Revision history for this message
Varun Palani (varun52mit) said :
#3

Thanks RaiMan, that solved my question.

Revision history for this message
Varun Palani (varun52mit) said :
#4

I have upgraded sikuli x to 1.1.1 and when i tried to execute the same

I am getting
"Syntax Error ((!! while importing!! mismatched input '\n'" expecting dedent (Image dictionary.py line 9.

Could you please help me.

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.