Capture command not work within a function

Asked by anubu

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 --------------

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.