Skip to content

Commit 7ca3e5b

Browse files
committed
fix session storage for windows (use os.replace instead of os.rename)
1 parent 7ec594d commit 7ca3e5b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chatblade/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def to_cache(messages, session):
5353
file_path_tmp = file_path + make_postfix()
5454
with open(file_path_tmp, "w") as f:
5555
yaml.dump(messages, f)
56-
os.rename(file_path_tmp, file_path)
56+
os.replace(file_path_tmp, file_path)
5757

5858

5959
def messages_from_cache(session):
@@ -84,7 +84,7 @@ def migrate_to_session(session):
8484
file_path_tmp = file_path + make_postfix()
8585
# resolve name conflict, but keep old cache file
8686
# until all has gone through fine
87-
os.rename(file_path, file_path_tmp)
87+
os.replace(file_path, file_path_tmp)
8888
to_cache(messages, session)
8989
os.unlink(file_path_tmp)
9090

0 commit comments

Comments
 (0)