[英]Sikuli - How to turn off FindFailed exceptions, setThrowException() not working
I'm using Sikulix IDE v2.0.5 and trying to search on the screen a specific word, then look at his right if there is another specific word.我正在使用 Sikulix IDE v2.0.5 并尝试在屏幕上搜索特定单词,然后查看他的右侧是否有另一个特定单词。
I saw that I should use setThrowException(False)
to Skip the FindFailed Exception, but when implementing it I still get them thrown.我看到我应该使用setThrowException(False)
来跳过 FindFailed 异常,但是在实现它时我仍然会抛出它们。
[error] FindFailed ( 1642158588596.png: (74x10) seen at (443, 190) with 1,00 in R[517,190 300x10]@S(0) )
[error] --- Traceback --- error source first
line: module ( function ) statement
6: main ( <module> ) if link.right(300).find("1642158588596.png"):
[error] --- Traceback --- end --------------
Looks like SCREEN.setThrowException(False)
wasn't taken into account after using Region's right()
function.使用 Region 的right()
function 后,似乎没有考虑SCREEN.setThrowException(False)
。
For it to work I needed to set the exception on the new Region returned by right()
:为了让它工作,我需要在right()
返回的新区域上设置异常:
for word in words:
word = word.right(300)
word.setThrowException(False)
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.