Encode as UTF-8 before writing to gz

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

Contributes to issue CURA-5097.
This commit is contained in:
Ghostkeeper 2018-03-16 16:05:51 +01:00
parent c1ea1320f0
commit 88912e3973
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A

View file

@ -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. if not success: #Writing the g-code failed. Then I can also not write the gzipped g-code.
return False return False
result = gzip.compress(gcode_textio.getvalue()) result = gzip.compress(gcode_textio.getvalue().encode("utf-8"))
stream.write(result) stream.write(result)
return True return True