From f17e461fdd2d78a622a1bc5885c68162a9e6f345 Mon Sep 17 00:00:00 2001 From: Stefan Holst Date: Fri, 19 May 2023 14:57:02 +0900 Subject: [PATCH] fix reading directly from file handle --- src/kyupy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kyupy/__init__.py b/src/kyupy/__init__.py index cd42d1b..2ed27f8 100644 --- a/src/kyupy/__init__.py +++ b/src/kyupy/__init__.py @@ -29,7 +29,7 @@ def popcount(a): def readtext(file): """Reads and returns the text in a given file. Transparently decompresses \\*.gz files.""" if hasattr(file, 'read'): - return file.read() + return file.read().decode() if str(file).endswith('.gz'): with gzip.open(file, 'rt') as f: return f.read()