From 212b67ac11fef2f48f8f7c1f180bad4f98244de7 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 11 May 2017 18:48:24 +0200 Subject: [PATCH] Bugfixing --- lib/trace_maillog/any_uncompress_file.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/trace_maillog/any_uncompress_file.py b/lib/trace_maillog/any_uncompress_file.py index b87591b..5b9c15f 100644 --- a/lib/trace_maillog/any_uncompress_file.py +++ b/lib/trace_maillog/any_uncompress_file.py @@ -36,7 +36,7 @@ import six # Own modules from trace_maillog import magic -__version__ = '0.4.1' +__version__ = '0.4.2' LOG = logging.getLogger(__name__) @@ -229,7 +229,7 @@ class AnyUncompressFile(object): raise NoFilehandleError() # ------------------------------------------------------------------------- - def seek(self, offset, whence=os.SEEK_SET) + def seek(self, offset, whence=os.SEEK_SET): if self._fh: return self._fh.seek(offset, whence) raise NoFilehandleError() @@ -312,7 +312,7 @@ def _open_gzip( open_args = {} mode = 'rb' if text and six.PY3: - mode = 'r' + mode = 'rt' if universal_newline: open_args['newline'] = os.linesep if encoding is None: @@ -326,7 +326,7 @@ def _open_gzip( LOG.debug("Opening gzip file {!r} with mod {!r}, other open arguments: {}".format( filename, mode, pp(open_args))) - fh = gzip.GzipFile(filename, mode, **open_args) + fh = gzip.open(filename, mode, **open_args) return AnyUncompressFile(fh, 'gzip') @@ -352,6 +352,7 @@ def _open_bzip2( open_args['buffering'] = buffering else: if text: + mode += 't' if universal_newline: open_args['newline'] = os.linesep if encoding is None: -- 2.39.5