File 0003-Fixed-to-logfile-output.patch of Package flac2all

From 33f65949f9af61e5011f0ed8806f731dbedbc772 Mon Sep 17 00:00:00 2001
From: zv <info@ziva-vatra.com>
Date: Thu, 27 Feb 2020 15:37:48 +0000
Subject: [PATCH 3/5] Fixed to logfile output

---
 flac2all_pkg/core.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/flac2all_pkg/core.py b/flac2all_pkg/core.py
index ca172e5..5ea205b 100755
--- a/flac2all_pkg/core.py
+++ b/flac2all_pkg/core.py
@@ -183,14 +183,15 @@ def generate_summary(start_time, end_time, count, results):
 def write_logfile(outdir, results):
     errout_file = os.path.join(outdir, "conversion_results.log")
     log.info("Writing log file (%s)" % errout_file)
-    fd = open(errout_file, "w")
+    fd = open(errout_file, "wb")
     fd.write(
-        "infile,outfile,format,conversion_status,return_code,execution_time\n"
+        "infile,outfile,format,conversion_status,return_code,execution_time\n".encode("utf-8")
     )
     for item in results:
-        item = [str(x, "utf-8") for x in item]
+        item = [str(x) for x in item]
         line = ','.join(item)
-        fd.write("%s\n" % line.encode("utf-8", "backslashreplace"))
+        line += "\n"
+        fd.write(line.encode("utf-8", "backslashreplace"))
     fd.close()
     log.print("Done!")
 
-- 
2.25.1

openSUSE Build Service is sponsored by