How can I disable error logs in sikuli?

Asked by Ignasi Bernadas

I have made a sikuli code that looks for images in a region. I have written this code in a computer with a screen resolution 1920x1080, and now I'm using it in other screen with a resolution 1600x900. I have made a function that resizes the region according to the new screen resolution and it works properly but, sikuli still prints an error message.

[error] Region(0,940,1920,140) outside any screen - subsequent actions might not work as expected

Is there any way to disable the error messages in sikuli? I've searched in the documentation and I found these commands but any of them disables the error messages.

Settings.ActionLogs = False
Settings.InfoLogs = False
Settings.DebugLogs = False

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :
#1

I think there is that definition of the region somewhere in codes.
Try to search for "Regin(0,940,1920,140)" in code file by Text editor.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Region(0,940,1920,140)

on a screen with 1600x900 apparently lies outside the screen (below bottom!)

So this is an error, that should be corrected.

check your region resize coding.

Revision history for this message
Ignasi Bernadas (ibernadas) said :
#3

I know this is an error for this screen but my sikuli program still works and I don't want an error code in the logs that doesn't affect to the execution of the code.

Here is the code (aprox) that produces this error.

bottom = Region(0,940,1920,140)

def adaptToScreenResolution():
        width = float(getW())
        height = float(getH())
        if width != 1920 or height != 1080:
            global bottom
            bottom = resizeRegion(bottom, width, height)

def resizeRegion(region, screenW, screenH):
    resizeFactorX = screenW/1920
    resizeFactorY = screenH/1080

    X = int(round(region.getX()*resizeFactorX))
    Y = int(round(region.getY()*resizeFactorY))
   W = int(round(region.getW()*resizeFactorX))
    H = int(round(region.getH()*resizeFactorY))

    return Region(X, Y, W, H)

adaptToScreenResolution()

Revision history for this message
Best RaiMan (raimund-hocke) said :
#4

bottom = Region(0,940,1920,140)
this produces the error and should be avoided, if you do not want the error on non-appropriate screen.

So let us fix it and additionally get better Python:

def adaptToScreenResolution(rx, ry, rw, rh):
    resizeFactorX = SCREEN.w/1920
    resizeFactorY = SCREEN.h/1080
    x = int(rx*resizeFactorX)
    y = int(ry*resizeFactorY)
   w = int(rw*resizeFactorX)
    h = int(rh*resizeFactorY)
    return Region(x, y, w, h)

bottom = adaptToScreenResolution(0, 940, 1920, 140)

Revision history for this message
Ignasi Bernadas (ibernadas) said :
#5

Ohh! Thanks! I think it's a good idea, this will solve my problem!

Revision history for this message
Ignasi Bernadas (ibernadas) said :
#6

Thanks RaiMan, that solved my question.