sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #42806
[Bug 1697575] Re: Error reported when using image with pattern match from a image module
I suggest adding a simple implementation guideline in the wiki to
summarize how to implement Sikuli so that users can understand the best
practice for storing common images used in different tests.
** Changed in: sikuli
Status: New => Invalid
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1697575
Title:
Error reported when using image with pattern match from a image module
Status in Sikuli:
Invalid
Bug description:
Sikuli version 1.1.1
Windows 10 (64 bit)
Java 1.8
Python
Using SikulixIDE
Setup:
Using two different modules in Python, WebSite2017 imports Screenshots.
"Screenshots" is used to define images and creates an object, it is a separate .sikuli project.
Screenshots Code:
class Screenshots():
def __init__(self):
self.Youarenowloggedout = Pattern("Youarenowloggedout.png").similar(0.72)
self.BackToOnlineStoreLink = "BackToOnlineStore.png"
-------------------------------------------------------------------------------------------
"WebSite2017" is the main execution module and contains the follow script (it is in a different .sikuli project and is the one that is run).
WebSite2017 Code:
PYTHONPICPATH="C:/Personal Folders/JD/SikuliXIDE/Screenshots.sikuli"
import os
addImagePath("C:/Personal Folders/JD/SikuliXIDE/Screenshots.sikuli")
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
sys.path.append(PYTHONPICPATH)
import Screenshots
reload(Screenshots)
ScreenshotsObj = Screenshots.Screenshots()
Settings.ClickDelay = 0.1
click(ScreenshotsObj.Youarenowloggedout)
click(ScreenshotsObj.BackToOnlineStoreLink)
===========================================================================
Execution results:
[error] script [ WebTest2017 ] stopped with error in line 18
[error] NameError ( global name 'Pattern' is not defined )
[error] --- Traceback --- error source first line: module ( function ) statement 3: Screenshots ( __init__ ) self.Youarenowloggedout = Pattern("Youarenowloggedout.png").similar(0.72)
[error] --- Traceback --- end --------------
===========================================================================
Identified Problem:
If the image in Screenshots doesn't have an adjustment for pattern matching then the WebSite2017 script executes without problems.
I modified the pattern match for the image in Screenshots (changed to
0.72) and the error occurs.
The variable created in Screenshots "Youarenowloggedout" doesn't get
assigned properly in WebSite2017.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1697575/+subscriptions
References