[EMAIL PROTECTED] schrieb: > i am trying to use python to walk thru each subdirectory from a top > directory. Here is my script: > > savedPagesDirectory = "/home/meryl/saved_pages/data" > > dir=open(savedPagesDirectory, 'r') > > for file in dir: > if (isdir(file)): > # get the full path of the file > fileName = savedPagesDirectory + file + 'index.html' > print fileName > > $ ./scripts/regressionTest.py > Traceback (most recent call last): > File "./scripts/regressionTest.py", line 12, in ? > dir=open(savedPagesDirectory, 'r') > IOError: [Errno 21] Is a directory > > But I get the above error: > > Can you please tell me what did I do wrong?
You can't open a directory. Use the function os.walk to do what you want. Diez -- http://mail.python.org/mailman/listinfo/python-list