Try a copy+remove instead of a rename to get a better idea of what is causing access denied errors when restoring database for some people on windows

This commit is contained in:
Kovid Goyal 2015-03-31 20:09:00 +05:30
parent 8e864305f3
commit 2729414b53

View File

@ -271,12 +271,8 @@ class Restore(Thread):
os.remove(save_path)
try:
os.rename(dbpath, save_path)
except OSError as err:
if getattr(err, 'winerror', None) == 32: # ERROR_SHARING_VIOLATION
time.sleep(30) # Wait a little for dropbox or the antivirus or whatever to release the file
os.rename(dbpath, save_path)
else:
raise
except EnvironmentError:
time.sleep(30) # Wait a little for dropbox or the antivirus or whatever to release the file
shutil.copyfile(dbpath, save_path)
os.remove(dbpath)
shutil.copyfile(ndbpath, dbpath)