File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
causal_testing/json_front Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -239,11 +239,11 @@ def check_file_exists(output_path: Path, overwrite: bool):
239
239
:param output_path: File path for the output file of the JSON Frontend
240
240
:param overwrite: bool that if true, the current file can be overwritten
241
241
"""
242
- if overwrite :
243
- file = open ( output_path , "w" , encoding = "utf-8" )
244
- file . close ()
245
- elif output_path . is_file () :
246
- raise FileExistsError (f"Chosen file output ({ output_path } ) already exists" )
242
+ if output_path . is_file () :
243
+ if overwrite :
244
+ output_path . unlink ()
245
+ else :
246
+ raise FileExistsError (f"Chosen file output ({ output_path } ) already exists" )
247
247
248
248
@staticmethod
249
249
def get_args (test_args = None ) -> argparse .Namespace :
You can’t perform that action at this time.
0 commit comments