Skip to content

Commit

Permalink
os.walk by default ignores errors
Browse files Browse the repository at this point in the history
  • Loading branch information
visch authored Mar 29, 2023
1 parent 12f4d96 commit 1f801ee
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 1f801ee

Please sign in to comment.