sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #11856
Re: [Question #203363]: Best way to open and close all files in a directory one at a time?
Question #203363 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/203363
Status: Open => Answered
RaiMan proposed the following answer:
Sorry, my fault - this should work:
open() should use the long fileName (absolute path).
import os
dir = "D:/Documents and Settings/user/Desktop/files"
for e in os.listdir(dir): # this starts the loop
fileName = os.path.join(dir, e)
print fileName
f = open(fileName)
# some operations on file f
click(png)
click(png)
f.close()
print "all files read" # this prints after the loop ends.
Mind the indentation (your clicks had no indentation though they belong
to the loop (see faq 1800)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.