Browse Source

Encode as UTF-8 before writing to gz

Turns out that gzip only accepts bytes as input, not str.

Contributes to issue CURA-5097.
Ghostkeeper 7 years ago
parent
commit
88912e3973
1 changed files with 1 additions and 1 deletions
  1. 1 1
      plugins/GCodeGzWriter/GCodeGzWriter.py

+ 1 - 1
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