[#65 state:fixed] Handle shutil.Error.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40166
This commit is contained in:
hsoft 2009-10-02 11:31:46 +00:00
parent 61af22403e
commit 0b968ac1ce
1 changed files with 5 additions and 3 deletions

View File

@ -8,6 +8,8 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
from __future__ import unicode_literals
import os
import os.path as op
import logging
@ -75,7 +77,7 @@ class DupeGuru(RegistrableApplication):
if not io.exists(dupe.path):
dupe.parent = None
return True
logging.warning(u"Could not send {0} to trash.".format(unicode(dupe.path)))
logging.warning("Could not send {0} to trash.".format(unicode(dupe.path)))
return False
def _do_load(self, j):
@ -92,7 +94,7 @@ class DupeGuru(RegistrableApplication):
try:
return self.data.GetDisplayInfo(dupe, group, delta)
except Exception as e:
logging.warning(u'Exception on GetDisplayInfo for %s: %s', unicode(dupe.path), unicode(e))
logging.warning("Exception on GetDisplayInfo for %s: %s", unicode(dupe.path), unicode(e))
return ['---'] * len(self.data.COLUMNS)
def _get_file(self, str_path):
@ -162,7 +164,7 @@ class DupeGuru(RegistrableApplication):
else:
files.move(source_path, dest_path)
self.clean_empty_dirs(source_path[:-1])
except (IOError, OSError) as e:
except EnvironmentError as e:
operation = 'Copy' if copy else 'Move'
logging.warning('%s operation failed on %s. Error: %s' % (operation, unicode(dupe.path), unicode(e)))
return False