From d9514e394e7a9091e437bf33e3cce11a8f065478 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 7 Sep 2010 13:20:53 -0600 Subject: [PATCH] Nicer error message when reanming a library fails --- src/calibre/gui2/actions/choose_library.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 955c751d19..79406da40c 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -177,7 +177,16 @@ class ChooseLibraryAction(InterfaceAction): return error_dialog(self.gui, _('Already exists'), _('The folder %s already exists. Delete it first.') % newloc, show=True) - os.rename(loc, newloc) + try: + os.rename(loc, newloc) + except: + import traceback + error_dialog(self.gui, _('Rename failed'), + _('Failed to rename the library at %s. ' + 'The most common cause for this is if one of the files' + ' in the library is open in another program.') % loc, + det_msg=traceback.format_exc(), show=True) + return self.stats.rename(location, newloc) self.build_menus()