Skip to content

Commit

Permalink
Check that the file exists before removing. (fix #110)
Browse files Browse the repository at this point in the history
  • Loading branch information
saimn committed Sep 7, 2014
1 parent 3f34057 commit fa7f9d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sigal/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ 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:
logger.error('Failed to process ' + source)
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):
Expand Down

0 comments on commit fa7f9d9

Please sign in to comment.