Skip to content

Commit

Permalink
Addtry, except block to catch errors on file update.
Browse files Browse the repository at this point in the history
  • Loading branch information
hreikin committed Mar 11, 2023
1 parent 716145b commit ac6212d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/streamlit_uploads_library/library.py
Expand Up @@ -54,7 +54,10 @@ def fetch_files(self):

def update_file(self, old_file, new_file, del_check=False):
if del_check == False:
old_file.replace(old_file.with_stem(new_file))
try:
old_file.rename(old_file.with_stem(new_file))
except FileExistsError as e:
logger.warning(e)
else:
try:
old_file.unlink()
Expand Down

0 comments on commit ac6212d

Please sign in to comment.