(path2file)
return found
Takes a list as a path, a single glob (*) is permitted as an entry which
    indicates that expansion at this location is required (i.e. version
    might not be known).
Takes a list as a path, a single glob (*) is permitted as an entry which
    indicates that expansion at this location is required (i.e. version
    might not be known).
Takes a list as a path a single glob ( * ) is permitted as an entry which indicates that expansion at this location is required ( i . e . version might not be known ) .
def check_file_at_path(path2file):
    """
    Takes a list as a path, a single glob (*) is permitted as an entry which
    indicates that expansion at this location is required (i.e. version
    might not be known).
    """
    found = None
    path2check = [os.path.split(os.path.split(sys.executable)[0])[0]]
    path2check += [os.getenv(n, '') for n in ['CONDA_PREFIX', 'PREFIX']]
    if sys.platform.startswith('win'):
        path2check += [os.path.join(p, 'Library') for p in path2check]
    for p in path2check:
        if p:
            if '*' in path2file:
                globloc = path2file.index('*')
                searchroot = os.path.join(*path2file[:globloc])
                try:
                    potential_locs = os.listdir(os.path.join(p, searchroot))
                except BaseException:
                    continue
                searchfor = path2file[globloc + 1:]
                for x in potential_locs:
                    potpath = os.path.join(p, searchroot, x, *searchfor)
                    if os.path.isfile(potpath):
                        found = p  # the latest is used
            elif os.path.isfile(os.path.join(p, *path2file)):
                found = p  # the latest is used
    return found
def check_file_at_path ( path2file ) : found = None path2check = [ os . path . split ( os . path . split ( sys . executable ) [ 0 ] ) [ 0 ] ] path2check += [ os . getenv ( n , '' ) for n in [ 'CONDA_PREFIX' , 'PREFIX' ] ] if sys . platform . startswith ( 'win' ) : path2check += [ os . path . join ( p , 'Library' ) for p in path2check ] for p in path2check : if p : if '*' in path2file : globloc = path2file . index ( '*' ) searchroot = os . path . join ( * path2file [ : globloc ] ) try : potential_locs = os . listdir ( os . path . join ( p , searchroot ) ) except BaseException : continue searchfor = path2file [ globloc + 1 : ] for x in potential_locs : potpath = os . path . join ( p , searchroot , x , * searchfor ) if os . path . isfile ( potpath ) : found = p # the latest is used elif os . path . isfile ( os . path . join ( p , * path2file ) ) : found = p # the latest is used return found