R. David Murray added the comment:
That's not how Python works. If you print out currentDir, you will see that
os.listdir is never called on the folder for which you do not have permission.
That is, os.walk does indeed catch the listdir error, when *it* does the
listdir, does not try to desc
New submission from Shelby Spencer:
The problem occurs when you attempt to perform an os.listdir on a directory
that you don't have access to. You should get an exception thrown. Normally
this occurs, however, if you run the following code:
folder =
for currentDir, subDirs, files = os.walk(