<div dir="ltr"><br><div class="gmail_quote">On Tue, May 3, 2011 at 07:39, Victor Varvariuc <span dir="ltr">&lt;<a href="mailto:victor.varvariuc@gmail.com">victor.varvariuc@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<a href="http://docs.python.org/library/os.html#os.walk" target="_blank">http://docs.python.org/library/os.html#os.walk</a><div><br></div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">


...<br><span style="font-family:sans-serif;font-size:16px;line-height:20px">By default errors from the <a title="os.listdir" href="http://docs.python.org/library/os.html#os.listdir" style="color:rgb(53, 95, 124);text-decoration:none" target="_blank"><tt style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:0.95em;font-weight:bold"><span>listdir()</span></tt></a> call are ignored. If optional argument <i>onerror</i> is specified, it should be a function; it will be called with one argument, an <a title="exceptions.OSError" href="http://docs.python.org/library/exceptions.html#exceptions.OSError" style="color:rgb(53, 95, 124);text-decoration:none" target="_blank"><tt style="background-color:transparent;padding-top:0px;padding-right:1px;padding-bottom:0px;padding-left:1px;font-size:0.95em;font-weight:bold"><span>OSError</span></tt></a> instance. <br>


</span><font face="sans-serif" size="3"><span style="line-height:20px">...</span></font></blockquote><div><a href="http://docs.python.org/library/os.html#os.walk" target="_blank"></a></div>
<div><font face="sans-serif" size="3"><span style="line-height:20px"><br></span></font></div><div><font face="sans-serif" size="3"><span style="line-height:20px">Looks like there should be walk() instead of listdir()</span></font><br>

</div></blockquote></div><br>walk() is implemented using listdir(), so I believe the documentation here is right. Here&#39;s the relevant code from os.walk():<br><br>    try:<br>        # Note that listdir and error are globals in this module due<br>

        # to earlier import-*.<br>        names = listdir(top)<br>    except error, err:<br>        if onerror is not None:<br>            onerror(err)<br>        return<br><br>As you can see, if listdir() throws an exception, it is ignored unless &quot;onerror&quot; is specified.<br>

<br>Eli<br><br><br></div>