changeset 45:97384a79043d

fixed crash when a source dir can't be accessed
author Goffi <goffi@goffi.org>
date Sat, 04 Jun 2011 20:32:50 +0200
parents 07e4c8f96a6e
children dda2195dc9f4
files gcp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gcp	Sat Jun 04 19:45:30 2011 +0200
+++ b/gcp	Sat Jun 04 20:32:50 2011 +0200
@@ -272,7 +272,12 @@
                 else:
                     self.__appendToList(filepath, dest_path, options)
         except OSError,e:
-            error(_("Can't append %(path)s to copy list: %(exception)s") % {'path':filepath.decode('utf-8','replace'),
+            try:
+                error(_("Can't append %(path)s to copy list: %(exception)s") % {'path':filepath.decode('utf-8','replace'),
+                                                             'exception':e.strerror})
+            except NameError:
+                #We can't list the dir
+                error(_("Can't access %(dirpath)s: %(exception)s") % {'dirpath':dirpath.decode('utf-8','replace'),
                                                              'exception':e.strerror})
 
     def __checkArgs(self, options, source_path, args):