IPython 8.4.0 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
filefind(filename: str, path_dirs=None) -> str

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 : str

The filename to look for.

path_dirs : str, None or sequence of str

The 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 , calling expandvars and expanduser before testing for existence.

Raises

IOError

Returns

path : str

returns absolute path to file.

Find a file by looking through a sequence of paths.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /IPython/utils/path.py#94
type: <class 'function'>
Commit: