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 descend into that subdirectory.
If you want to do something with the error (such as raise it), use the 'onerror' argument of walk. ---------- nosy: +r.david.murray resolution: -> invalid stage: -> committed/rejected status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20259> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com