← Back to team overview

sikuli-driver team mailing list archive

[Question #288410]: How can I save screenshot as "system date.png"

 

New question #288410 on Sikuli:
https://answers.launchpad.net/sikuli/+question/288410

I have written a code using sikuli , where when my scripts fails it has to take a screenshot with current system date and time
 *The problem I am facing here is I want to save the screenshot with current system date and time*
Is it possible to do so?

Following is my code:

from time import strftime
a=(strftime("%Y%m%d"))
print a
now = time.localtime()
b=(str(now.tm_hour)+":"+str(now.tm_min))
print b;
filename = a + b
print filename
screenshotsDir = "C:\Users\sucheta\Desktop\screenshots"
shutil.move(img, os.path.join(screenshotsDir, "error.png"))

In the above code instead of saving the screenshot as error.png I want it to be saved as filename.png

Please help me out.

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