From b968ece9a7f89db2b8d1d4ccc1f8399a7e8b59a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Tarroja=20Caubet?= Date: Wed, 26 Mar 2025 18:09:18 +0100 Subject: [PATCH] Open CSV export file using with newline translation The csv documentation [1] explains that file object used in writer should be opened with newline as empty string. [1] https://docs.python.org/3/library/csv.html Closes #12115 --- tryton/tryton/gui/window/form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/tryton/gui/window/form.py b/tryton/tryton/gui/window/form.py index 26f37b6c4a..5b31984163 100644 --- a/tryton/tryton/gui/window/form.py +++ b/tryton/tryton/gui/window/form.py @@ -435,7 +435,7 @@ class Form(TabContent): delimiter = ';' fileno, fname = tempfile.mkstemp( '.csv', common.slugify(export['name']) + '_') - with open(fname, 'w') as fp: + with open(fname, 'w', newline='') as fp: writer = csv.writer(fp, delimiter=delimiter) for row, path in zip_longest(data, paths or []): indent = len(path) - 1 if path else 0