Browse code

handle OSError: No such file or directory in get_local_filelist

reported to s3tools-bugs by John R. Moser 2013-01-09.

Matt Domsch authored on 2014/01/10 02:40:31
Showing 1 changed files
... ...
@@ -18,6 +18,7 @@ import sys
18 18
 import glob
19 19
 import copy
20 20
 import re
21
+import errno
21 22
 
22 23
 __all__ = ["fetch_local_list", "fetch_remote_list", "compare_filelists", "filter_exclude_include"]
23 24
 
... ...
@@ -226,7 +227,14 @@ def fetch_local_list(args, is_src = False, recursive = None):
226 226
                     relative_file = replace_nonprintables(relative_file)
227 227
                 if relative_file.startswith('./'):
228 228
                     relative_file = relative_file[2:]
229
-                sr = os.stat_result(os.lstat(full_name))
229
+                try:
230
+                    sr = os.stat_result(os.lstat(full_name))
231
+                except OSError, e:
232
+                    if e.errno == errno.ENOENT:
233
+                        # file was removed async to us getting the list
234
+                        continue
235
+                    else:
236
+                        raise
230 237
                 loc_list[relative_file] = {
231 238
                     'full_name_unicode' : unicodise(full_name),
232 239
                     'full_name' : full_name,