(filename, dirs=[], env="PATH")
Find file in current dir or system path
Find file in current dir or system path
Find file in current dir or system path
def _where(filename, dirs=[], env="PATH"):
    """Find file in current dir or system path"""
    if not isinstance(dirs, list):
        dirs = [dirs]
    if glob(filename):
        return filename
    paths = [os.curdir] + os.environ[env].split(os.path.pathsep) + dirs
    for path in paths:
        for match in glob(os.path.join(path, filename)):
            if match:
                return os.path.normpath(match)
    raise IOError("File not found: %s" % filename)
def _where ( filename , dirs = [ ] , env = "PATH" ) : if not isinstance ( dirs , list ) : dirs = [ dirs ] if glob ( filename ) : return filename paths = [ os . curdir ] + os . environ [ env ] . split ( os . path . pathsep ) + dirs for path in paths : for match in glob ( os . path . join ( path , filename ) ) : if match : return os . path . normpath ( match ) raise IOError ( "File not found: %s" % filename )