← Back to team overview

sikuli-driver team mailing list archive

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: Solved => Open

Johnnyninja is still having a problem:
dir = "some directory" is pointing to a path on my desktop similar to
this.

D:/Documents and Settings/user/Desktop/files

I'm getting an IOError:( No such file or directory)
If I comment out f=open(e) the script will print the files in the dir.

I have the script set up like this.

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(e)
    # some operations on file f
click(png)
click(png)
    f.close()
print "all files read" # this prints after the loop ends.

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