Skip to content

Commit

Permalink
Bugfix: dvc repro - check if files exist before actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmpetrov committed Dec 25, 2017
1 parent 8b433c6 commit b2de95e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dvc/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def changed(self):
if not self.use_cache:
changed = self._changed_md5()
else:
changed = not os.path.samefile(self.path, self.cache)
changed = os.path.exists(self.path) \
and os.path.exists(self.cache) \
and not os.path.samefile(self.path, self.cache)

if changed:
self.project.logger.debug('{} changed'.format(self.path))
Expand Down Expand Up @@ -173,8 +175,9 @@ def changed(self):

def remove_outs(self):
for out in self.outs:
self.project.logger.debug("Removing '{}'".format(out.path))
os.unlink(out.path)
if os.path.exists(out.path):
self.project.logger.debug("Removing '{}'".format(out.path))
os.unlink(out.path)

def remove(self):
self.remove_outs()
Expand Down

0 comments on commit b2de95e

Please sign in to comment.