From 5d1d8f048c5a09c820d4ade09d340ff2180dd69c Mon Sep 17 00:00:00 2001 From: yongchand Date: Mon, 12 Dec 2022 13:50:59 +0900 Subject: [PATCH] Add ignore errors to rmtree --- klaytnetl/cli/export_block_group.py | 4 ++-- klaytnetl/cli/export_trace_group.py | 4 ++-- klaytnetl/cli/export_traces.py | 2 +- klaytnetl/cli/gcs_sync.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/klaytnetl/cli/export_block_group.py b/klaytnetl/cli/export_block_group.py index fac073a..c5d5b36 100644 --- a/klaytnetl/cli/export_block_group.py +++ b/klaytnetl/cli/export_block_group.py @@ -264,7 +264,7 @@ def export_block_group( }, file_maxlines is None, ) - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir, ignore_errors=True) if gcs_bucket: sync_to_gcs( @@ -279,4 +279,4 @@ def export_block_group( }, file_maxlines is None, ) - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir, ignore_errors=True) diff --git a/klaytnetl/cli/export_trace_group.py b/klaytnetl/cli/export_trace_group.py index 703f355..92194b4 100644 --- a/klaytnetl/cli/export_trace_group.py +++ b/klaytnetl/cli/export_trace_group.py @@ -251,7 +251,7 @@ def export_trace_group( {traces_output, contracts_output, tokens_output}, file_maxlines is None, ) - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir, ignore_errors=True) if gcs_bucket: sync_to_gcs( @@ -260,4 +260,4 @@ def export_trace_group( {traces_output, contracts_output, tokens_output}, file_maxlines is None, ) - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir, ignore_errors=True) diff --git a/klaytnetl/cli/export_traces.py b/klaytnetl/cli/export_traces.py index e9754f7..bf28c86 100644 --- a/klaytnetl/cli/export_traces.py +++ b/klaytnetl/cli/export_traces.py @@ -186,4 +186,4 @@ def export_traces( if s3_bucket is not None: sync_to_s3(s3_bucket, tmpdir, {output}, file_maxlines is None) - shutil.rmtree(tmpdir) + shutil.rmtree(tmpdir, ignore_errors=True) diff --git a/klaytnetl/cli/gcs_sync.py b/klaytnetl/cli/gcs_sync.py index bb51eb9..c5d4cec 100644 --- a/klaytnetl/cli/gcs_sync.py +++ b/klaytnetl/cli/gcs_sync.py @@ -51,7 +51,7 @@ def sync_to_gcs(bucket, tmpdir, outputs, is_single_file): logging.info(f"Transfer {file} --> gcs://{bucket}/{out}") blob = bucket_name.blob(f'{bucket}/{out}') blob.upload_from_filename(f'{file}') - shutil.rmtree(temp_path) + shutil.rmtree(temp_path, ignore_errors=True) def _get_files(path, is_single_file):