From 865cbb37c581d3d4c69d8c5c32a3190e1f45e8a1 Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Tue, 5 Mar 2024 08:17:02 -0500 Subject: [PATCH 1/2] Use utf-8 when printing dd files --- xl2times/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xl2times/__main__.py b/xl2times/__main__.py index 0feeb3c..0a150d2 100644 --- a/xl2times/__main__.py +++ b/xl2times/__main__.py @@ -332,6 +332,7 @@ def produce_times_tables( def write_dd_files( tables: Dict[str, DataFrame], config: datatypes.Config, output_dir: str ): + encoding = "utf-8" os.makedirs(output_dir, exist_ok=True) for item in os.listdir(output_dir): if item.endswith(".dd"): @@ -373,7 +374,7 @@ def convert_parameter(tablename: str, df: DataFrame): } for fname, tablenames in tables_in_file.items(): - with open(os.path.join(output_dir, fname), "w") as fout: + with open(os.path.join(output_dir, fname), "w", encoding=encoding) as fout: for tablename in [t for t in tablenames if t in tables]: df = tables[tablename] if tablename in sets: From 6c96480e53826b2abf76c0411845c1b20b72835b Mon Sep 17 00:00:00 2001 From: Olexandr Balyk Date: Tue, 5 Mar 2024 09:05:34 -0500 Subject: [PATCH 2/2] Exclude MILESTONYR from output.dd --- xl2times/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xl2times/__main__.py b/xl2times/__main__.py index 0a150d2..a90b6dd 100644 --- a/xl2times/__main__.py +++ b/xl2times/__main__.py @@ -370,7 +370,9 @@ def convert_parameter(tablename: str, df: DataFrame): tables_in_file = { "ts.dd": ["ALL_TS"], "milestonyr.dd": ["MILESTONYR"], - "output.dd": [t for t in config.dd_table_order if t != "ALL_TS"], + "output.dd": [ + t for t in config.dd_table_order if t not in ["ALL_TS", "MILESTONYR"] + ], } for fname, tablenames in tables_in_file.items():