mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
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:
parent
8e864305f3
commit
2729414b53
@ -271,12 +271,8 @@ class Restore(Thread):
|
|||||||
os.remove(save_path)
|
os.remove(save_path)
|
||||||
try:
|
try:
|
||||||
os.rename(dbpath, save_path)
|
os.rename(dbpath, save_path)
|
||||||
except OSError as err:
|
except EnvironmentError:
|
||||||
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
|
||||||
time.sleep(30) # Wait a little for dropbox or the antivirus or whatever to release the file
|
shutil.copyfile(dbpath, save_path)
|
||||||
os.rename(dbpath, save_path)
|
os.remove(dbpath)
|
||||||
else:
|
|
||||||
raise
|
|
||||||
shutil.copyfile(ndbpath, dbpath)
|
shutil.copyfile(ndbpath, dbpath)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user