pygeodes.utils.io.file_exists#

pygeodes.utils.io.file_exists(filepath: str, raise_exception: bool = True) bool[source]#

This checks if the file exists, and, in function of a boolean parameter, raises an exception if it doesn’t

Parameters:
filepathstr

the filepath to check the existence of

raise_exceptionbool, optional

whether to raise an exception, by default True

Returns:
bool

whether the file exists

Raises:
FileNotFoundError

error raised if the file doesn’t exist

See also

similar_filenames

to find the most similar filenames to a filename

Examples

name = "file.txt"
exists = file_exists(name)