#NEWLINE# def findfile( file , here = __file__ , subdir = None ) : #NEWLINE# #INDENT# 'Try to find a file on sys.path and the working directory.  If it is not\n    found the argument passed to the function is returned (this does not\n    necessarily signal failure; could still be the legitimate path).' #NEWLINE# if os . path . isabs ( file ) : #NEWLINE# #INDENT# return file #NEWLINE# #UNINDENT# if ( subdir is not None ) : #NEWLINE# #INDENT# file = os . path . join ( subdir , file ) #NEWLINE# #UNINDENT# path = sys . path #NEWLINE# path = ( [ os . path . dirname ( here ) ] + path ) #NEWLINE# for dn in path : #NEWLINE# #INDENT# fn = os . path . join ( dn , file ) #NEWLINE# if os . path . exists ( fn ) : #NEWLINE# #INDENT# return fn #NEWLINE# #UNINDENT# #UNINDENT# return file