mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-28 21:13:30 +02: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
1 changed files with 4 additions and 8 deletions
|
|
@ -271,12 +271,8 @@ def replace_db(self):
|
|||
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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue