sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #44575
[Question #660939]: Capture command not work within a function
New question #660939 on Sikuli:
https://answers.launchpad.net/sikuli/+question/660939
Hi, I've experienced some odd error that I don't know where to begin to look for a fix. The function capture_screen_old() would work if I run it individually. However, when I nested it in another function, it would fail and give me the error below.
So, if I run error_no_reset() or capture_screen_old() by themselves, they'll work. But if the two mentioned functions are run with a larger set of functions/scripts, it would fail.
Any help is greatly appreciated. Thank you for your time.
def error_no_reset():
capture_screen_old()
if exists(icon): reset_script()
else: pass
def capture_screen_old():
reg_capture = Region(Region(943,0,423,727))
screen_title = "screen capture " + time.strftime("%Y%m%d %H%M%S") + ".png"
screenshotsDir = "D:\\temp"
img = capture(reg_capture)
shutil.move(img, os.path.join(screenshotsDir, screen_title))
[error] script [ test script ] stopped with error in line 1572
[error] AttributeError ( 'Region' object has no attribute 'cmdCapture' )
[error] --- Traceback --- error source first line: module ( function ) statement 55: Sikuli ( capture ) AttributeError: 'Region' object has no attribute 'cmdCapture'
31: main ( capture_screen_old ) img = capture(reg_capture)
422: main ( error_no_reset ) capture_screen_old()
[error] --- Traceback --- end --------------
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.