Skip to content

Commit

Permalink
Merge pull request #48 from visch/patch-1
Browse files Browse the repository at this point in the history
os.walk by default ignores errors
  • Loading branch information
ets authored Jan 6, 2024
2 parents 646c069 + 1f801ee commit 3f6bcb6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tap_spreadsheets_anywhere/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ def list_files_in_ftp_server(uri, search_prefix=None):
LOGGER.info("Found {} files.".format(entries))
return entries

def raise_error(error):
raise error

def list_files_in_local_bucket(bucket, search_prefix=None):
local_filenames = []
Expand All @@ -253,7 +255,7 @@ def list_files_in_local_bucket(bucket, search_prefix=None):

LOGGER.info(f"Walking {path}.")
max_results = 10000
for (dirpath, dirnames, filenames) in walk(path):
for (dirpath, dirnames, filenames) in walk(path, onerror=raise_error):
for filename in filenames:
abspath = os.path.join(dirpath,filename)
relpath = os.path.relpath(abspath, path)
Expand Down

0 comments on commit 3f6bcb6

Please sign in to comment.