[Python-Dev] os.walk() silently ignores errors

Mark Russell mrussell@verio.net
Tue, 13 May 2003 16:40:07 +0100


>Ignoring is definitely the right thing to do by default, as otherwise
>the existence of a single unreadable directory would cause your entire
>walk to fail.  What's your use case for wanting to do something else?

I was using os.walk() to copy a directory tree with some modifications - I
assumed that as no exceptions had been raised the tree had been copied
successfully.  It was only when I diffed the original and copy trees that I
found some directories had been skipped because they were unreadable.
Had I not checked I would have silently lost data - not behaviour I expect
from a python script :-)

Mark