Check that the file exists before removing. (fix #110)

This commit is contained in:
Simon Conseil
2014-09-07 23:09:53 +02:00
parent 3f340573ce
commit fa7f9d9528

View File

@@ -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):