← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #221802]: screen.capture() not saving a file but only when run from command line

 

Question #221802 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/221802

    Status: Open => Answered

RaiMan proposed the following answer:
The files created by capture() are saved in a temp folder and deleted
when the Java process ends (IDE: when IDE is stopped, CommandLine: when
script ends)

So you do not see any file left in your command line case.

If you want to keep the file:

import shutil
shutil.move(img, "safe_location.png")

BTW: your example above "Sikuli-like":

def screenGrab():
    return capture(SCREEN)

or more flexible:

def screenGrab(reg = None):
# reg must be a Screen/Region/Match object
    if reg:
        return capture(SCREEN)
    else:
        return capture(reg)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.