← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #315005]: [1.1.1] shutil.move(pic, sfile) returns error (ScreenImage coercion to string)

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
def snapit(msg):
    bounds = getBounds()
    pic = Screen(0).capture(bounds) # pic now is a ScreenImage object
    print("snapshot taken, + msg")
    msg = msg.rstrip("\n")
    sfile = path + "OSX10.11.5 " + time.strftime("%Y-%m-%d %H.%M.%S ") + msg + ".png"
    shutil.move(pic,sfile)

--- possible solution:
def snapit(msg):
    pic = capture(getBounds())
    print("snapshot taken," + msg)
    msg = msg.strip()
    sfile ="%s_%s_%s" % ("OSX10.11.5",  time.strftime("%Y-%m-%d %H.%M.%S"), msg) # spaces in filenames not recommended
    pic.getFile(path, sfile) # stores the image as path+sfile.png

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.