def file_exists(filename): """Determines whether a path exists or not. Args: filename: string, a path Returns: True if the path exists, whether its a file or a directory. """ return pywrap_tensorflow.FileExists(compat.as_bytes(filename))
def file_exists_v2(path): """Determines whether a path exists or not. Args: path: string, a path Returns: True if the path exists, whether it's a file or a directory. False if the path does not exist and there are no filesystem errors. Raises: errors.OpError: Propagates any errors reported by the FileSystem API. """ try: pywrap_tensorflow.FileExists(compat.as_bytes(path)) except errors.NotFoundError: return False return True
def file_exists(filename): """Determines whether a path exists or not. Args: filename: string, a path Returns: True if the path exists, whether its a file or a directory. False if the path does not exist and there are no filesystem errors. Raises: errors.OpError: Propagates any errors reported by the FileSystem API. """ try: with errors.raise_exception_on_not_ok_status() as status: pywrap_tensorflow.FileExists(compat.as_bytes(filename), status) except errors.NotFoundError: return False return True
def file_exists(filename): return pywrap_tensorflow.FileExists(compat.as_bytes(filename))