From 88912e39735ab8ea25a9823ebc49c970efcc5e04 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 16 Mar 2018 16:05:51 +0100 Subject: [PATCH] Encode as UTF-8 before writing to gz Turns out that gzip only accepts bytes as input, not str. Contributes to issue CURA-5097. --- plugins/GCodeGzWriter/GCodeGzWriter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/GCodeGzWriter/GCodeGzWriter.py b/plugins/GCodeGzWriter/GCodeGzWriter.py index 4ced6d03ba..06fafb5995 100644 --- a/plugins/GCodeGzWriter/GCodeGzWriter.py +++ b/plugins/GCodeGzWriter/GCodeGzWriter.py @@ -36,6 +36,6 @@ class GCodeGzWriter(MeshWriter): if not success: #Writing the g-code failed. Then I can also not write the gzipped g-code. return False - result = gzip.compress(gcode_textio.getvalue()) + result = gzip.compress(gcode_textio.getvalue().encode("utf-8")) stream.write(result) return True