diff --git a/afew/MailMover.py b/afew/MailMover.py index 6e55a56..f3c749f 100644 --- a/afew/MailMover.py +++ b/afew/MailMover.py @@ -73,6 +73,9 @@ def move(self, maildir, rules): try: shutil.copy2(fname, self.get_new_name(fname, destination)) to_delete_fnames.append(fname) + except shutil.SameFileError: + logging.warn("trying to move '{}' onto itself".format(fname)) + continue except shutil.Error as e: # this is ugly, but shutil does not provide more # finely individuated errors