wait to the file is closed before to remove (Windows)

master
kirbylife 2020-12-18 17:46:02 -06:00
parent 0ff9facb54
commit a625c95f34
1 changed files with 7 additions and 1 deletions

View File

@ -204,7 +204,13 @@ class MunyalClient(Icon):
f.write(base64.b85decode(data["file"].encode("ascii")))
os.rename(temp_dir, full_path)
else:
os.remove(full_path)
while True:
try:
os.remove(full_path)
break
except:
print("Maybe the file is open, please close first")
sleep(5)
else:
if data["action"] == "add":
os.mkdir(full_path)