[Patches] find file permissions error
Douglas Kirkland
kirkland@blarg.net
Mon, 28 Feb 2000 17:44:54 +0000
This is a multi-part message in MIME format.
--------------CD7CF55A9676CA9115F2DA2D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Find file has permissions error in Python 1.5.2. I add error correction
so it does not crash because of permission denied.
--
I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims"). To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.
I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation. I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation.
Douglas Kirkland
kirkland@blarg.net
--------------CD7CF55A9676CA9115F2DA2D
Content-Type: text/plain; charset=us-ascii;
name="find.py"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="find.py"
import fnmatch
import os
_debug = 0
_prune = ['(*)']
def find(pattern, dir = os.curdir):
list = []
try:
names = os.listdir(dir)
names.sort()
for name in names:
fullname = os.path.join(dir, name)
if fnmatch.fnmatch(name, pattern):
list.append(fullname)
if os.path.isdir(fullname) and not os.path.islink(fullname):
if _debug: print "descend into", `fullname`
list = list + find(pattern, fullname)
return list
except OSError:
if _debug: print 'Permission denied'
return list
--------------CD7CF55A9676CA9115F2DA2D--