From e0939049dd0eb6c20d1a41deda92a2dd95ec9f4b Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 8 Feb 2023 09:26:24 -0800 Subject: [PATCH] force 'wb' mode for gzipfile --- masque/file/dxf.py | 2 +- masque/file/gdsii.py | 2 +- masque/file/oasis.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/masque/file/dxf.py b/masque/file/dxf.py index 8af24e6..24bc6a0 100644 --- a/masque/file/dxf.py +++ b/masque/file/dxf.py @@ -130,7 +130,7 @@ def writefile( with tmpfile(path) as base_stream: streams: Tuple[Any, ...] = (base_stream,) if path.suffix == '.gz': - gz_stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream)) + gz_stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream, mode='wb')) streams = (gz_stream,) + streams else: gz_stream = base_stream diff --git a/masque/file/gdsii.py b/masque/file/gdsii.py index cb55a37..966f797 100644 --- a/masque/file/gdsii.py +++ b/masque/file/gdsii.py @@ -145,7 +145,7 @@ def writefile( with tmpfile(path) as base_stream: streams: Tuple[Any, ...] = (base_stream,) if path.suffix == '.gz': - stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream)) + stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream, mode='wb')) streams = (stream,) + streams else: stream = base_stream diff --git a/masque/file/oasis.py b/masque/file/oasis.py index ab34852..d0955b5 100644 --- a/masque/file/oasis.py +++ b/masque/file/oasis.py @@ -190,7 +190,7 @@ def writefile( with tmpfile(path) as base_stream: streams: Tuple[Any, ...] = (base_stream,) if path.suffix == '.gz': - stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream)) + stream = cast(IO[bytes], gzip.GzipFile(filename='', mtime=0, fileobj=base_stream, mode='wb')) streams += (stream,) else: stream = base_stream