Skip to content

Commit

Permalink
Report delete failures during library mode to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Dec 10, 2015
1 parent 022b011 commit 10738ac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/calibre/db/backend.py
Expand Up @@ -13,7 +13,7 @@

import apsw

from calibre import isbytestring, force_unicode, prints
from calibre import isbytestring, force_unicode, prints, as_unicode
from calibre.constants import (iswindows, filesystem_encoding,
preferred_encoding)
from calibre.ptempfile import PersistentTemporaryFile, TemporaryFile
Expand Down Expand Up @@ -1704,13 +1704,15 @@ def move_library_to(self, all_paths, newloc, progress=lambda x: x):
for loc in old_dirs:
try:
shutil.rmtree(loc)
except EnvironmentError:
pass
except EnvironmentError as e:
if os.path.exists(loc):
prints('Failed to delete:', loc, 'with error:', as_unicode(e))
for loc in old_files:
try:
os.remove(loc)
except EnvironmentError:
pass
except EnvironmentError as e:
if e.errno != errno.ENOENT:
prints('Failed to delete:', loc, 'with error:', as_unicode(e))
try:
os.rmdir(odir)
except EnvironmentError:
Expand Down

0 comments on commit 10738ac

Please sign in to comment.