From fa7f9d9528c0a0a5a287daeeddda864d3167ba4e Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 7 Sep 2014 23:09:53 +0200 Subject: [PATCH] Check that the file exists before removing. (fix #110) --- sigal/video.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sigal/video.py b/sigal/video.py index 65ecd4e..166f8b8 100644 --- a/sigal/video.py +++ b/sigal/video.py @@ -44,7 +44,8 @@ def check_subprocess(cmd, source, outname): returncode, stdout, stderr = call_subprocess(cmd) except KeyboardInterrupt: logger.debug('Process terminated, removing file %s', outname) - os.remove(outname) + if os.path.isfile(outname): + os.remove(outname) raise if returncode: @@ -52,7 +53,8 @@ def check_subprocess(cmd, source, outname): logger.debug('STDOUT:\n %s', stdout) logger.debug('STDERR:\n %s', stderr) logger.debug('Process failed, removing file %s', outname) - os.remove(outname) + if os.path.isfile(outname): + os.remove(outname) def video_size(source):