From 45b9fcefd22b0847fcdbc5e629d7be323cb9a03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 7 Apr 2020 19:18:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20gzip=20encoding=20under=20?= =?UTF-8?q?Python=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gzip.compress doesn't exist in Py2, replace with gzip.open. Introduced by #3497 --- src/octoprint/server/util/webassets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/server/util/webassets.py b/src/octoprint/server/util/webassets.py index 299be0401..9a7f37316 100644 --- a/src/octoprint/server/util/webassets.py +++ b/src/octoprint/server/util/webassets.py @@ -124,8 +124,8 @@ class GzipFile(Filter): if output_path: gzipped_output_path = output_path + ".gz" try: - with open(gzipped_output_path, "wb") as gzipped_output: - gzipped_output.write(gzip.compress(data.encode("utf8"), compresslevel=9)) + with gzip.open(gzipped_output_path, "wb", 9) as f: + f.write(data.encode("utf8")) except Exception: logging.getLogger(__name__).exception("Error writing gzipped " "output of {} to {}".format(output_path,