finder = None cropped_images = [] for crop_filename in image_filenames: crop_basename = splitext(basename(crop_filename))[0] # print "crp {} vs img {}".format(crop_basename, image_basename) if image_filename is not crop_filename: if crop_basename.startswith(image_basename): #print "base match" cropped_images.append(crop_filename) print cropped_images for cropped_image in cropped_images: print "cropped_image " + cropped_image if finder is None: finder = Finder(image_filename) print "matching {} in {}".format(cropped_image, image_filename) # match cropped_image in image_filename finder.findAll(cropped_image) matches = sorted((m for m in finder), key=lambda m:m.getScore()) l = len(matches) print "found {} matches".format(l) if l == 1: m = matches[0] name = splitext(basename(cropped_image))[0] image_dict[name] = { 'filename': relpath(cropped_image, getBundlePath()), 'source_filename': relpath(image_filename, getBundlePath()), 'source': image_basename, 'x': m.getX(),