From 9735b5aaa9afda0a16ff2b3b014ed4184ecc584d Mon Sep 17 00:00:00 2001 From: Jan Stratil Date: Mon, 12 Aug 2024 17:04:26 +0200 Subject: [PATCH] dvc dependency repo: Catch FileNotFoundError (#10501) - When checkouting non-existent file the _checkout_file recursively calls os.stat on a symlinked file which destination doesn't exist. This causes a FileNotFoundError but it is not catched and it causes an unexpected error instead. Fixes #10500. --- dvc/dependency/repo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dvc/dependency/repo.py b/dvc/dependency/repo.py index 811107b6fc..058891b786 100644 --- a/dvc/dependency/repo.py +++ b/dvc/dependency/repo.py @@ -115,7 +115,7 @@ def download(self, to: "Output", jobs: Optional[int] = None): state=self.repo.state, prompt=confirm, ) - except CheckoutError: + except (CheckoutError, FileNotFoundError): super().download(to=to, jobs=jobs) def update(self, rev: Optional[str] = None):