Ignore non-existent directories for bug #171809. This is required for readonly mode...
authorZac Medico <zmedico@gentoo.org>
Fri, 23 Mar 2007 00:16:32 +0000 (00:16 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 23 Mar 2007 00:16:32 +0000 (00:16 -0000)
svn path=/main/branches/2.1.2/; revision=6266

pym/cache/flat_hash.py

index 48e8a175e6ab1347adae4af4477fdaf8b282a753..48145881c9e5ab219d842cc7bc10be02a697b32f 100644 (file)
@@ -107,7 +107,15 @@ class database(fs_template.FsBased):
                dirs = [self.location]
                len_base = len(self.location)
                while len(dirs):
-                       for l in os.listdir(dirs[0]):
+                       try:
+                               dir_list = os.listdir(dirs[0])
+                       except OSError, e:
+                               if e.errno != errno.ENOENT:
+                                       raise
+                               del e
+                               dirs.pop(0)
+                               continue
+                       for l in dir_list:
                                if l.endswith(".cpickle"):
                                        continue
                                p = os.path.join(dirs[0],l)