[Python-Dev] os.walk() silently ignores errors (original) (raw)
Guido van Rossum guido@python.org
Tue, 13 May 2003 09:51:33 -0400
- Previous message: [Python-Dev] os.walk() silently ignores errors
- Next message: [Python-Dev] os.walk() silently ignores errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've just noticed that os.walk() silently skips unreadable directories. I think this is surprising behaviour, which at least should be documented (there is a comment explaining this is source, but nothing in the doc string). Is it too late to add an optional callback argument to handle unreadable directories, so the caller could log them, raise an exception or whatever? I think the default behaviour should still be to silently ignore them, but it would be nice to have a way to override it.
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?
--Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] os.walk() silently ignores errors
- Next message: [Python-Dev] os.walk() silently ignores errors
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]