Retry rename of imported config directory

In case an AV program has locked the imported config directory on
Windows, sigh.
This commit is contained in:
Kovid Goyal 2017-07-06 20:37:04 +05:30
parent f53fdebabd
commit 6ae397126b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -357,6 +357,10 @@ def import_data(importer, library_path_map, config_location=None, progress1=None
raise raise
time.sleep(1) time.sleep(1)
shutil.rmtree(config_location) shutil.rmtree(config_location)
try:
os.rename(base_dir, config_location)
except EnvironmentError:
time.sleep(2)
os.rename(base_dir, config_location) os.rename(base_dir, config_location)
from calibre.gui2 import gprefs from calibre.gui2 import gprefs
gprefs.refresh() gprefs.refresh()
@ -420,5 +424,6 @@ def run_importer():
# }}} # }}}
if __name__ == '__main__': if __name__ == '__main__':
export(sys.argv[-1], progress1=print, progress2=print) export(sys.argv[-1], progress1=print, progress2=print)