Skip to content

Commit

Permalink
itemize exception context; messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed May 10, 2019
1 parent 2e40736 commit 143d257
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pypiper/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,9 +1831,11 @@ def clean_add(self, regex, conditional=False, manual=False):
self.clean_initialized = True

if manual:
try:
filenames = glob.glob(regex)
for filename in filenames:
filenames = glob.glob(regex)
if not filenames:
print("No files match cleanup pattern: {}".format(regex))
for filename in filenames:
try:
with open(self.cleanup_file, "a") as myfile:
relative_filename = os.path.relpath(filename, self.outfolder) \
if os.path.isabs(filename) else filename
Expand All @@ -1844,8 +1846,8 @@ def clean_add(self, regex, conditional=False, manual=False):
myfile.write("rm " + relative_filename + "/*\n")
# and the directory itself
myfile.write("rmdir " + relative_filename + "\n")
except:
pass
except Exception as e:
print("Error in clean_add on path {}: {}".format(filename, str(e)))
elif conditional:
self.cleanup_list_conditional.append(regex)
else:
Expand All @@ -1855,7 +1857,6 @@ def clean_add(self, regex, conditional=False, manual=False):
while regex in self.cleanup_list_conditional:
self.cleanup_list_conditional.remove(regex)


def _cleanup(self, dry_run=False):
"""
Cleans up (removes) intermediate files.
Expand Down

0 comments on commit 143d257

Please sign in to comment.