🐛 Fix gzip encoding under Python 2
gzip.compress doesn't exist in Py2, replace with gzip.open. Introduced by #3497
This commit is contained in:
1 parent
5ad06bc602
commit
45b9fcefd2
1 file changed
+2
-2
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user