← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #187064]: Unable to import/ name "Pattern" is not defined

 

Question #187064 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/187064

    Status: Open => Answered

RaiMan proposed the following answer:
well not really exactly ;-)

What I have missed: There is a problem with your path notation:
either:
myScriptPath = "D:\\SIKULI" # backslashes have to be escaped
or
myScriptPath = r"D:\SIKULI" # raw string no need to escape anything

This produced a wrong sys.path entry, but your scripts where found any
way, because Sikuli import looks in the directory too, where the main
script was loaded from.

So your problem is, that you have some syntax error in your library.sikuli script.
Just load it and run it in IDE (it should "do" nothing and you will find out why. 
Sorry, but Sikuli does not report back syntax errors when importing another .sikuli.

--- BTW:
in main.script saying
library.confirm

does not make many sense, because it does nothing.
I really recommend to use 
from library import *
because you can use your image/pattern variables directly without the ugly library.

--- and in library the brackets around the images are not needed

confirm = thumbnail

is sufficient, where thumbnail is the thumbnail image.

so have a look, there might  be a bracket missing

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.