From 573f2b9358cacf596b1fda6807f91b86bc5b7b34 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Fri, 16 Jul 2010 17:47:25 +0200 Subject: Warn if the temporary directory is not empty on cleanup --- archivemail.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/archivemail.py b/archivemail.py index 4adf6b1..f570456 100755 --- a/archivemail.py +++ b/archivemail.py @@ -160,8 +160,13 @@ class StaleFiles: vprint("removing stale tempfile directory '%s'" % self.temp_dir) try: os.rmdir(self.temp_dir) - self.temp_dir = None - except (IOError, OSError): pass + except OSError, e: + if e.errno == errno.ENOTEMPTY: # Probably a bug + user_warning("cannot remove temporary directory '%s', " + "directory not empty" % self.temp_dir) + except IOError: pass + else: self.temp_dir = None + class Options: -- cgit v1.2.3