aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2022-02-03 10:11:36 +0100
committerTibor Frank <tifrank@cisco.com>2022-02-03 09:18:22 +0000
commit1070f86debd7e6ab221f2d81b6e0f1c40acea3ff (patch)
treed69a4b3ec10510ae175c0a2d6952af4af2ac2094
parente80ad95d071411b4847a5fd0f9dadaf57297939b (diff)
PAL: Process exception while writing table
- table_merged_details Change-Id: I4ee8b1c2f56c367e22d6e75853c8bb074d62935b Signed-off-by: Tibor Frank <tifrank@cisco.com> (cherry picked from commit 100fc988c8140e36affac9fadc770328cc1d34b2)
-rw-r--r--resources/tools/presentation/generator_tables.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py
index a7b1500f29..59250d0678 100644
--- a/resources/tools/presentation/generator_tables.py
+++ b/resources/tools/presentation/generator_tables.py
@@ -489,10 +489,17 @@ def table_merged_details(table, input_data):
separator = u"" if table[u'output-file'].endswith(u"/") else u"_"
file_name = f"{table[u'output-file']}{separator}{suite_name}.csv"
logging.info(f" Writing file: {file_name}")
- with open(file_name, u"wt") as file_handler:
- file_handler.write(u",".join(header) + u"\n")
- for item in table_lst:
- file_handler.write(u",".join(item) + u"\n")
+ try:
+ with open(file_name, u"wt") as file_handler:
+ file_handler.write(u",".join(header) + u"\n")
+ for item in table_lst:
+ file_handler.write(u",".join(item) + u"\n")
+ except Exception as err:
+ logging.error(f"{err}")
+ logging.info(header)
+ logging.info(table_lst)
+ if file_handler:
+ file_handler.close()
logging.info(u" Done.")