← Back to team overview

sikuli-driver team mailing list archive

[Bug 1865973] [NEW] SikuliXception in find function when used with 0 cache and same file name

 

Public bug reported:

Sikuli 2.0.2
Window 10 , 64 bit - version 1709

Following is code that I have reduced to reproduce this issue:

import java.io.File;
import java.io.IOException;

import org.python.google.common.io.Files;
import org.sikuli.basics.Settings;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public class OtherWay {

	public static void main(String[] args) throws IOException {
		Settings.setImageCache(0);
		try {
			copyAndSearch("This");
			copyAndSearch("Sounds");
			copyAndSearch("Very");
			copyAndSearch("Title");
		} catch (FindFailed | IOException e) {
			// TODO Auto-generated catch block
			// e.printStackTrace();
			System.out.println("Exception FindFailed or IOException");
		}
	}
	
	public static void copyAndSearch(String fileName) throws IOException, FindFailed {
		Screen r = new Screen(0);
		File f = new File("C:/temp/" + fileName + ".png");
		File f2 = new File("C:/temp/tempimage.png");
		Files.copy(f, f2);
		Pattern p1 = new Pattern("C:/temp/tempimage.png").similar((float) 0.7);
		r.find(p1);
	}
}


Following is traces:

Exception in thread "main" org.sikuli.script.SikuliXception: image to search (66, 23) is larger than image to search in (56, 29)
	at org.sikuli.script.Finder$FindInput2.isValid(Finder.java:1243)
	at org.sikuli.script.Finder$Finder2.doFind(Finder.java:613)
	at org.sikuli.script.Finder$Finder2.find(Finder.java:579)
	at org.sikuli.script.Finder.find(Finder.java:211)
	at org.sikuli.script.Region.doCheckLastSeenAndCreateFinder(Region.java:2989)
	at org.sikuli.script.Region.checkLastSeenAndCreateFinder(Region.java:2959)
	at org.sikuli.script.Region.doFind(Region.java:2906)
	at org.sikuli.script.Region.find(Region.java:2327)
        ......

Please note that, image to search on screen (this.png, sounds.png etc.)
should be visible on screen while running above code.

** Affects: sikuli
     Importance: Undecided
         Status: New

** Attachment added: "This is image that should be visible on screen while running code snippet"
   https://bugs.launchpad.net/bugs/1865973/+attachment/5333258/+files/SikuliXceptionBug.PNG

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1865973

Title:
  SikuliXception in find function when used with  0 cache and same file
  name

Status in Sikuli:
  New

Bug description:
  Sikuli 2.0.2
  Window 10 , 64 bit - version 1709

  Following is code that I have reduced to reproduce this issue:

  import java.io.File;
  import java.io.IOException;

  import org.python.google.common.io.Files;
  import org.sikuli.basics.Settings;
  import org.sikuli.script.FindFailed;
  import org.sikuli.script.Pattern;
  import org.sikuli.script.Screen;

  public class OtherWay {

  	public static void main(String[] args) throws IOException {
  		Settings.setImageCache(0);
  		try {
  			copyAndSearch("This");
  			copyAndSearch("Sounds");
  			copyAndSearch("Very");
  			copyAndSearch("Title");
  		} catch (FindFailed | IOException e) {
  			// TODO Auto-generated catch block
  			// e.printStackTrace();
  			System.out.println("Exception FindFailed or IOException");
  		}
  	}
  	
  	public static void copyAndSearch(String fileName) throws IOException, FindFailed {
  		Screen r = new Screen(0);
  		File f = new File("C:/temp/" + fileName + ".png");
  		File f2 = new File("C:/temp/tempimage.png");
  		Files.copy(f, f2);
  		Pattern p1 = new Pattern("C:/temp/tempimage.png").similar((float) 0.7);
  		r.find(p1);
  	}
  }

  
  Following is traces:

  Exception in thread "main" org.sikuli.script.SikuliXception: image to search (66, 23) is larger than image to search in (56, 29)
  	at org.sikuli.script.Finder$FindInput2.isValid(Finder.java:1243)
  	at org.sikuli.script.Finder$Finder2.doFind(Finder.java:613)
  	at org.sikuli.script.Finder$Finder2.find(Finder.java:579)
  	at org.sikuli.script.Finder.find(Finder.java:211)
  	at org.sikuli.script.Region.doCheckLastSeenAndCreateFinder(Region.java:2989)
  	at org.sikuli.script.Region.checkLastSeenAndCreateFinder(Region.java:2959)
  	at org.sikuli.script.Region.doFind(Region.java:2906)
  	at org.sikuli.script.Region.find(Region.java:2327)
          ......

  Please note that, image to search on screen (this.png, sounds.png
  etc.) should be visible on screen while running above code.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1865973/+subscriptions


Follow ups