Sikuli generates useless PNG files while running...

Asked by prokher

Hi all!

I faced the following problem. During running Sikuli script it generates useless PNG files in the test directory. Looks like it makes screenshot every time method exists() fails. I am using stable 1.0.1. There is simple script to reproduce this behavior below. IDE feature to remove useless PNG helps, but not when I run tests in batch mode using our cmake/ctest routine... Is there any setting to disable this?

app = App("gnome-calculator")
app.open()
for i in xrange(int(100500)):
  wnd = app.window()
  if wnd is not None:
    with Region(wnd) as region:
      if region.exists("1409168557236.png", 0):
        break

Best regards and thanks in advance,
Alexander.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

This only happens, if you use the with construct (which indeed has some quirks).

In your case the usage does not really make sense anyway:
- you are not saving any typing
- and you get an additional indent

this works as expected:

app = App("gnome-calculator")
app.open()
for i in xrange(int(100500)):
  wnd = app.window()
  if wnd is not None:
    region = Region(wnd)
    if region.exists("1409168557236.png", 0):
      break

Nevertheless thanks for point in out. I take it as a bug.

Revision history for this message
prokher (prokher) said :
#2

Dear RaiMan,

thank you very much for the workaround, looks like it works (though I need to check on the main project).
Actually I added 'as region' to 'with' because context manager did not work without it. I mean functions like 'exists' or 'wait' could not find image in the application's window. Possibly the reason is that I have 2 screens connected. So I had to add 'as region' and use 'region.exists' and 'region.wait' which worked.

Best regards,
Alexander.

Can you help with this problem?

Provide an answer of your own, or ask prokher for more information if necessary.

To post a message you must log in.