diff --git a/tosfs/core.py b/tosfs/core.py index 5b75853..5ac18f3 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -526,7 +526,7 @@ def exists(self, path: str, **kwargs: Any) -> bool: try: return retryable_func_executor( - lambda: self.tos_client.head_object(bucket, key) or True, + lambda: self.tos_client.head_object(bucket, key) and True, max_retry_num=self.max_retry_num, ) except TosServerError as e: @@ -536,7 +536,7 @@ def exists(self, path: str, **kwargs: Any) -> bool: lambda: self.tos_client.head_object( bucket, key.rstrip("/") + "/" ) - or True, + and True, max_retry_num=self.max_retry_num, ) except TosServerError as ex: