Skip to content

Commit d247608

Browse files
committed
Better exception handling around log folders
1 parent 7a3fbbc commit d247608

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

seleniumbase/core/log_helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ def log_folder_setup(log_path, archive_logs=False):
168168
archived_folder, int(time.time()))
169169

170170
if len(os.listdir(log_path)) > 0:
171-
shutil.move(log_path, archived_logs)
172-
os.makedirs(log_path)
171+
try:
172+
shutil.move(log_path, archived_logs)
173+
os.makedirs(log_path)
174+
except Exception:
175+
pass # A file was probably open at the time
173176
if not settings.ARCHIVE_EXISTING_LOGS and not archive_logs:
174177
shutil.rmtree(archived_logs)
175178
else:

0 commit comments

Comments
 (0)