← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Im new to programming/scripting, so please bear with me.

What I'm trying to do is to create 2 modules: methods and library.
In methods , ill be keeping all the methods required to run a test (e.g. 

def step(x):
    wait (x, FOREVER)
    click (x))

In library i want all the images (and names appended to them, e.g.  confirm = (Pattern("1328523896591-1.png").similar(0.78)) ))


What im trying to do is import the library and methods to the main script. All the scripts are in the D:\Sikuli.

Heres a snippet of my script:

myScriptPath = "D:\SIKULI"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
import methods
import library

library.confirm
methods.step

methods imports and works fine, but im having problems with library (I've got from sikuli import * added in both modules.). 
Here's the error I'm getting:

ImportError: Errors in loading sikuli module: library
name 'Pattern' is not defined
 - HOW TO FIX? Try adding "from sikuli import *" in the module.




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