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 = <some parent folder that has a child folder you don't have read access 
to>
for currentDir, subDirs, files = os.walk(folder):
    temp = os.listdir(currentDir)

temp will hold an empty list on the subdirectory you don't have access to and 
no exception is thrown.  This appears to be some sort of conflict between 
os.walk and os.listdir.  Near as I can tell python is caching the subdirectory 
listing for subDirs (os.walk doesn't throw an error on attempting to read a 
directory is doesn't have access to, obviously) and returning those results 
when os.listdir is called.

----------
components: IO
messages: 208100
nosy: shellster
priority: normal
severity: normal
status: open
title: os.walk conflicts with os.listdir
type: behavior
versions: Python 2.7

_______________________________________
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

Reply via email to