Check if file or dir before deleting
@@ -12,6 +12,9 @@ def delete_path(path):
if not os.path.exists(path):
return
try:
+ if os.path.isfile(path):
+ os.remove(path)
+ else:
shutil.rmtree(path)
except OSError:
logger.warning('Could not delete path `{}`'.format(path))
