diff options
author | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-08 19:37:36 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@sugarlabs.org> | 2009-01-08 19:37:36 (GMT) |
commit | 5d15f1caf33f050bf8c3a0422f8a950b186a6215 (patch) | |
tree | 6110dfb4e30f09c1cf639ea77307a3ecd57d0758 /src | |
parent | 60c2d108f22903d1dc8b73cff1d67d43e3b19929 (diff) |
Dont abort if we cannot read a file from a removable device
Diffstat (limited to 'src')
-rw-r--r-- | src/jarabe/journal/model.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py index a4f40a0..ba98a48 100644 --- a/src/jarabe/journal/model.py +++ b/src/jarabe/journal/model.py @@ -20,6 +20,7 @@ from datetime import datetime import time import shutil from stat import S_IFMT, S_IFDIR, S_IFREG +import traceback import dbus import gconf @@ -226,12 +227,15 @@ class InplaceResultSet(BaseResultSet): def _build_file_list(self, dir_path): for entry in os.listdir(dir_path): full_path = dir_path + '/' + entry - - stat = os.stat(full_path) - if S_IFMT(stat.st_mode) == S_IFDIR: - self._build_file_list(full_path) - elif S_IFMT(stat.st_mode) == S_IFREG: - self._file_list.append((full_path, stat, int(stat.st_mtime))) + try: + stat = os.stat(full_path) + if S_IFMT(stat.st_mode) == S_IFDIR: + self._build_file_list(full_path) + elif S_IFMT(stat.st_mode) == S_IFREG: + self._file_list.append((full_path, stat, int(stat.st_mtime))) + except Exception, e: + logging.error('Error reading file %r: %r' % \ + (full_path, traceback.format_exc())) def _query_mount_point(self, mount_point, query): t = time.time() |