From 5824d391f1a4ce1263bc97faef402b2528f5c71b Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Tue, 13 Feb 2018 13:45:32 +0200 Subject: [PATCH] output: check if dir exists before creating it Signed-off-by: Ruslan Kuprieiev --- dvc/output.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dvc/output.py b/dvc/output.py index f516085af..3950163e3 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -235,7 +235,11 @@ class Output(Dependency): for relpath, cache in self.dir_cache().items(): path = os.path.join(self.path, relpath) - os.makedirs(os.path.dirname(path)) + dname = os.path.dirname(path) + + if not os.path.exists(dname): + os.makedirs(dname) + self.hardlink(cache, path) def save(self):