Skip to content

Commit

Permalink
Update write_stat_ascii.py
Browse files Browse the repository at this point in the history
assign bare exception to 'exception RuntimeError' for failure to create a WriteStatAscii object and 'exception OSError' when the make directory call raises an exception due to directory already existing.
  • Loading branch information
bikegeek authored Oct 9, 2024
1 parent 9d94bb7 commit 9699d37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions METreformat/write_stat_ascii.py
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ def main():
# Create the log directory if it doesn't alreaedy exist
try:
os.makedirs(log_dir)
except:
except OSError:
# ignore warning that is raised
# when the directory already exists
pass
Expand All @@ -2065,7 +2065,7 @@ def main():
stat_lines_obj: WriteStatAscii = WriteStatAscii(parms, logger)
# stat_lines_obj.write_stat_ascii(file_df, parms, logger)
stat_lines_obj.write_stat_ascii(file_df, parms)
except:
except RuntimeError:
print(
"*** %s occurred setting up write_stat_ascii ***", sys.exc_info()[0])
sys.exit("*** Error setting up write_stat_ascii")
Expand Down

0 comments on commit 9699d37

Please sign in to comment.