[Python-checkins] python/dist/src/Doc/lib libos.tex,1.124,1.125

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 13 May 2003 11:01:22 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv31799

Modified Files:
	libos.tex 
Log Message:
Add optional 'onerror' argument to os.walk(), to control error
handling.


Index: libos.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v
retrieving revision 1.124
retrieving revision 1.125
diff -C2 -d -r1.124 -r1.125
*** libos.tex	10 May 2003 03:35:37 -0000	1.124
--- libos.tex	13 May 2003 18:01:19 -0000	1.125
***************
*** 1055,1059 ****
  \end{funcdesc}
  
! \begin{funcdesc}{walk}{top\optional{, topdown\code{=True}}}
  \index{directory!walking}
  \index{directory!traversal}
--- 1055,1060 ----
  \end{funcdesc}
  
! \begin{funcdesc}{walk}{top\optional{, topdown\code{=True}
!                        \optional{, onerror\code{=None}}}}
  \index{directory!walking}
  \index{directory!traversal}
***************
*** 1087,1090 ****
--- 1088,1098 ----
  false is ineffective, because in bottom-up mode the directories in
  \var{dirnames} are generated before \var{dirnames} itself is generated.
+ 
+ By default errors from the \code{os.listdir()} call are ignored.  If
+ optional argument \var{onerror} is specified, it should be a function;
+ it will be called with one argument, an os.error instance.  It can
+ report the error to continue with the walk, or raise the exception
+ to abort the walk.  Note that the filename is available as the
+ \code{filename} attribute of the exception object.
  
  \begin{notice}