From 241dfed3eef612f71ad43042867ed888c29c67d1 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Sat, 3 Mar 2018 11:42:45 -0800 Subject: [PATCH] Not expected files in dir cache --- dvc/output.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dvc/output.py b/dvc/output.py index dcdf8c83a..4e1a6b244 100644 --- a/dvc/output.py +++ b/dvc/output.py @@ -236,8 +236,13 @@ class Output(Dependency): relpath = os.path.relpath(path, self.cache) with open(path, 'r') as fd: d = yaml.safe_load(fd) - md5 = d[Output.PARAM_MD5] - res[relpath] = self.project.cache.get(md5) + + if not isinstance(d, dict): + msg = 'Dir cache file format error \'{}\': skipping the file' + self.project.logger.error(msg.format(relpath)) + else: + md5 = d[Output.PARAM_MD5] + res[relpath] = self.project.cache.get(md5) return res def checkout(self):