def filefind(filename, path_dirs=None):
 filename = filename.strip('"').strip("'")
 if (os.path.isabs(filename) and os.path.isfile(filename)):
  return filename
 if (path_dirs is None):
  path_dirs = ('',)
 elif isinstance(path_dirs, str):
  path_dirs = (path_dirs,)
 for path in path_dirs:
  if (path == '.'):
   path = os.getcwd()
  testname = expand_path(os.path.join(path, filename))
  if os.path.isfile(testname):
   return os.path.abspath(testname)
 raise IOError(('File %r does not exist in any of the search paths: %r' % (filename, path_dirs)))

def filefind ( filename , path_dirs = None ) : filename = filename . strip ( '"' ) . strip ( "'" ) if ( os . path . isabs ( filename ) and os . path . isfile ( filename ) ) : return filename if ( path_dirs is None ) : path_dirs = ( '' , ) elif isinstance ( path_dirs , str ) : path_dirs = ( path_dirs , ) for path in path_dirs : if ( path == '.' ) : path = os . getcwd ( ) testname = expand_path ( os . path . join ( path , filename ) ) if os . path . isfile ( testname ) : return os . path . abspath ( testname ) raise IOError ( ( 'File %r does not exist in any of the search paths: %r' % ( filename , path_dirs ) ) )
find a file by looking through a sequence of paths .