Using the (non-standard yet) path module (http://www.jorendorff.com/articles/python/path/), your code can be simplified to:
from path import path, copy def copy_first_match(repository, filename, dest_dir): try: first_match = path(repository).walkfiles(filename).next() except StopIteration: return False else: copy(first_match, dest_dir) return True I/O exceptions are left to propagate to the caller. George -- http://mail.python.org/mailman/listinfo/python-list