← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #182604]: Using a common resource folder for Sikuli Images with the IDE

 

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

Description changed to:
Greetings,

I've been using Sikuli a great deal(X-1.0rc3). Now that I have many
scripts written I want to start using a shared resource folder for
images. This way each script relies on using the same images.

Here is what I have:

Folder Structure:
C:\Home
C:\Home\TestScript.Sikuli
C:\Home\imagelibrary
C:\Home\lib

MyImage.png is in C:\Home\imagelibrary

[CODE]
# get the directory containing your running .sikuli
import os
scriptLocation = os.path.dirname(getBundlePath())
if not scriptLocation in sys.path: sys.path.append(scriptLocation)
if not scriptLocation + "\lib" in sys.path: sys.path.append(scriptLocation + "\lib")
if not scriptLocation + "\imagelibrary.sikuli" in getImagePath(): addImagePath(scriptLocation + "\imagelibrary.sikuli")

click("MyImage.png")
[/CODE]

Now the script executes fine. However, when I want to use the additional features of the IDE (i.e. "Matching Preview" and "Target Offset") the IDE has a "mini-crash" and spits this to the output:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: im == null!
 at javax.imageio.ImageIO.write(Unknown Source)
 at javax.imageio.ImageIO.write(Unknown Source)
 at org.sikuli.ide.Utils.saveTmpImage(Utils.java:140)
 at org.sikuli.ide.ImageButton.createThumbnail(ImageButton.java:111)
 at org.sikuli.ide.ImageButton.createThumbnail(ImageButton.java:116)
 at org.sikuli.ide.ImageButton.setFilename(ImageButton.java:64)
 at org.sikuli.ide.ImageButton.getFilename(ImageButton.java:58)
 at org.sikuli.ide.PatternWindow.createTargetPanel(PatternWindow.java:87)
 at org.sikuli.ide.PatternWindow.(PatternWindow.java:55)
 at org.sikuli.ide.ImageButton.actionPerformed(ImageButton.java:213)
 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 at javax.swing.plaf.basic.Ba

[error] Can't read file: Can't read input file!

sicButtonListener.mouseReleased(Unknown Source)
 at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
 at java.awt.Component.processMouseEvent(Unknown Source)
 at javax.swing.JComponent.processMouseEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Window.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
 at java.awt.EventQueue.access$000(Unknown Source)
 at java.awt.EventQueue$1.run(

Unknown Source)
 at java.awt.EventQueue$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
 at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue$2.run(Unknown Source)
 at java.awt.EventQueue$2.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)

Additionally, the IDE won't replace "MyImage.png" until I re-open the
script after running it. (This is because its not a part of the image
path until the script runs. Is there a good way around this?)

Thank you for your time and I hope I was clear enough.

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