[issue20259] os.walk conflicts with os.listdir

R. David Murray report at bugs.python.org
Tue Jan 14 17:11:13 CET 2014


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 <report at bugs.python.org>
<http://bugs.python.org/issue20259>
_______________________________________


More information about the Python-bugs-list mailing list