(cls, filename, search_dirs=('.',))
return absolute_filename
Locate a file with given filename that can be opened by one
        of the available readers.

        Parameters
        ----------
        filename : str
        search_dirs : Iterable[str]

        Returns
        -------
        str
            Absolute path to the file
Locate a file with given filename that can be opened by one
        of the available readers.
Locate a file with given filename that can be opened by one of the available readers .
def locate(cls, filename, search_dirs=('.',)):
        """Locate a file with given filename that can be opened by one
        of the available readers.

        Parameters
        ----------
        filename : str
        search_dirs : Iterable[str]

        Returns
        -------
        str
            Absolute path to the file
        """
        if path.exists(filename):
            return filename

        for directory in search_dirs:
            absolute_filename = path.join(directory, filename)
            if path.exists(absolute_filename):
                break
            for ext in cls.readers:
                if fnmatch(path.basename(filename), '*' + ext):
                    break
                # glob uses fnmatch internally
                matching_files = glob(absolute_filename + ext)
                if matching_files:
                    absolute_filename = matching_files[0]
                    break
            if path.exists(absolute_filename):
                break
        else:
            absolute_filename = ""

        if not path.exists(absolute_filename):
            raise IOError('File "{}" was not found.'.format(filename))

        return absolute_filename
def locate ( cls , filename , search_dirs = ( '.' , ) ) : if path . exists ( filename ) : return filename for directory in search_dirs : absolute_filename = path . join ( directory , filename ) if path . exists ( absolute_filename ) : break for ext in cls . readers : if fnmatch ( path . basename ( filename ) , '*' + ext ) : break # glob uses fnmatch internally matching_files = glob ( absolute_filename + ext ) if matching_files : absolute_filename = matching_files [ 0 ] break if path . exists ( absolute_filename ) : break else : absolute_filename = "" if not path . exists ( absolute_filename ) : raise IOError ( 'File "{}" was not found.' . format ( filename ) ) return absolute_filename