From 76238d65fbd93d115bb0ca1577d685f598f9ea7a Mon Sep 17 00:00:00 2001 From: samuelhavelka Date: Tue, 20 Feb 2024 13:26:53 +0100 Subject: [PATCH 1/2] handle AttributeError when sys.stdout is redirected to None --- src/keboola/component/base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/keboola/component/base.py b/src/keboola/component/base.py index a05fda5..ec81257 100644 --- a/src/keboola/component/base.py +++ b/src/keboola/component/base.py @@ -101,7 +101,11 @@ def action_wrapper(self, *args, **kwargs): if is_sync_action: # sync action expects valid JSON in stdout on success. result_str = process_sync_action_result(result) - sys.stdout.write(result_str) + # handle cases, when there is sync action called from another sync_action + try: + sys.stdout.write(result_str) + except AttributeError: + pass return result From 27eb7ac950e2245167925e88c2ef3172cda78dc9 Mon Sep 17 00:00:00 2001 From: KCF Date: Tue, 20 Feb 2024 12:33:37 +0000 Subject: [PATCH 2/2] Automated html docs build --- docs/base.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/base.html b/docs/base.html index 123bcaa..672218e 100644 --- a/docs/base.html +++ b/docs/base.html @@ -129,7 +129,11 @@

Module keboola.component.base

if is_sync_action: # sync action expects valid JSON in stdout on success. result_str = process_sync_action_result(result) - sys.stdout.write(result_str) + # handle cases, when there is sync action called from another sync_action + try: + sys.stdout.write(result_str) + except AttributeError: + pass return result @@ -522,7 +526,11 @@

Args

if is_sync_action: # sync action expects valid JSON in stdout on success. result_str = process_sync_action_result(result) - sys.stdout.write(result_str) + # handle cases, when there is sync action called from another sync_action + try: + sys.stdout.write(result_str) + except AttributeError: + pass return result