← Back to team overview

sikuli-driver team mailing list archive

[Question #142070]: How to pass an image as argument into subroutine

 

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

Hi all,

I'd like to fill-in a form repeatedly using a subroutine for this task, e.g.

def fill_form(code,image):
	click(xxxxx)  # captured image
	type(code)
	click(yyyyy) # captured image
	click(image) # image passed as the argument
	click(zzzzz) # captured image
        ...
	click(OK) # captured image

fill_form("999",image1)
fill_form("998",image2)
etc...

image1 is the captured image having name i.png, which *exists* in the same folder where .py script resides. When I run the script, I got the error:

Traceback (most recent call last):
  File "C:\Users\PETRFE~1\AppData\Local\Temp\sikuli-tmp1397197302814887988.py", line 37, in <module>
    fill_form("999","i.png")
  File "C:\Users\PETRFE~1\AppData\Local\Temp\sikuli-tmp1397197302814887988.py", line 7, in fill_form
    click(image)
  File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\Region.py", line 119, in click
  Line 11, in file C:\Users\PETRFE~1\AppData\Local\Temp\sikuli-tmp1397197302814887988.py

	at org.sikuli.script.Region.wait(Region.java:289)
	at org.python.proxies.sikuli.Region$Region$1.super__wait(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)

org.sikuli.script.FindFailed: FindFailed: i.png can't be found.
  Line 11, in file C:\Users\PETRFE~1\AppData\Local\Temp\sikuli-tmp1397197302814887988.py

Please, could somebody point me what I'm missing?

Thx, pf

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