bundles / IPython 9.5.0 / IPython / utils / path / filefind
function
IPython.utils.path:filefind
source: /IPython/utils/path.py :93
Signature
def filefind ( filename : str , path_dirs = None ) → str Summary
Find a file by looking through a sequence of paths.
Extended Summary
This iterates through a sequence of paths looking for a file and returns the full, absolute path of the first occurrence of the file. If no set of path dirs is given, the filename is tested as is, after running through expandvars and expanduser. Thus a simple call
filefind('myfile.txt')will find the file in the current working dir, but
filefind('~/myfile.txt')Will find the file in the users home directory. This function does not automatically try any paths, such as the cwd or the user's home directory.
Parameters
filename: strThe filename to look for.
path_dirs: str, None or sequence of strThe sequence of paths to look for the file in. If None, the filename need to be absolute or be in the cwd. If a string, the string is put into a sequence and the searched. If a sequence, walk through each element and join with
filename, callingexpandvarsandexpanduserbefore testing for existence.
Returns
path: strreturns absolute path to file.
Raises
: IOError
Aliases
-
IPython.core.shellapp.filefind