Skip to content

Commit

Permalink
Merge pull request #23 from johandahlberg/no_dir_to_remove_bug
Browse files Browse the repository at this point in the history
Handle error when dir to remove did not exist
  • Loading branch information
Johan Hermansson authored Jan 23, 2017
2 parents 853d339 + b4fad49 commit a41ad60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bcl2fastq/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.1.2"
__version__ = "1.1.3"
13 changes: 12 additions & 1 deletion bcl2fastq/lib/bcl2fastq_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
import os
import errno
from itertools import groupby
import logging
import shutil
Expand Down Expand Up @@ -321,7 +322,17 @@ def delete_output(self):
"""
self.validate_output()
log.info("Found a directory at output path {}, will remove it.".format(self.config.output))
shutil.rmtree(self.config.output)
try:
shutil.rmtree(self.config.output)
except OSError as e:
# Ignore if the error is of type "No such file or directory"
if e.errno == errno.ENOENT:
log.debug("No such output directory, with path: {} will not remove it.".format(self.config.output))
pass
else:
log.error("Got error with error number {} when trying to remove dir: {}".format(e.errno,
self.config.output))
raise e

def symlink_output_to_unaligned(self):
"""
Expand Down

0 comments on commit a41ad60

Please sign in to comment.