From 7beddf345b56862b8da3dae37e5840a5a554ec88 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org>
Date: Mon, 19 Jul 2010 23:12:21 +0200
Subject: [PATCH] print nice error message on OSError (permission denied, etc.)

---
 pyclean | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pyclean b/pyclean
index f211262..72dbd5a 100755
--- a/pyclean
+++ b/pyclean
@@ -61,11 +61,11 @@ def destroyer():  # ;-)
             pyfile = (yield)
             for filename in find_files_to_remove(pyfile):
                 try:
-                    log.debug('removing %s', filename)
                     remove(filename)
                     counter += 1
-                except IOError:
+                except (IOError, OSError), e:
                     log.error('cannot remove %s', filename)
+                    log.debug(e)
     except GeneratorExit:
         if counter:
             log.info("removed files: %s", counter)
-- 
GitLab