Skip to content

Commit

Permalink
MetadataWriter can now remove existing files from previous runs
Browse files Browse the repository at this point in the history
Former-commit-id: 4550b0c
  • Loading branch information
mkazmier committed Apr 16, 2020
1 parent edc5db2 commit 26328f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion imgtools/io/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, root_directory, filename_format="{subject_id}.json", create_d
raise ValueError(f"File format {self.file_format} not supported. Supported formats: JSON (.json), CSV (.csv), Pickle (.pkl).")

if self.file_format == "csv" and self.remove_existing:
out_path = os.path.exists(os.path.join(self.root_directory, self.filename_format))
out_path = os.path.join(self.root_directory, self.filename_format)
if os.path.exists(out_path):
os.remove(out_path) # remove existing CSV instead of appending

Expand Down

0 comments on commit 26328f7

Please sign in to comment.