Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 28c91c2

Browse files
[BUG FIX] xxxOperations::_read__text_with_encoding opens a file as text
LocalOps uses "open(filename, mode='r', encoding=encoding)" RemoteOps uses "io.TextIOWrapper(io.BytesIO(binaryData), encoding=encoding)" It solves a problem on Windows.
1 parent 4e23e03 commit 28c91c2

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

testgres/operations/local_ops.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,10 @@ def read(self, filename, encoding=None, binary=False):
286286
def _read__text_with_encoding(self, filename, encoding):
287287
assert type(filename) == str # noqa: E721
288288
assert type(encoding) == str # noqa: E721
289-
content = self._read__binary(filename)
290-
assert type(content) == bytes # noqa: E721
291-
content_s = content.decode(encoding)
292-
assert type(content_s) == str # noqa: E721
293-
return content_s
289+
with open(filename, mode='r', encoding=encoding) as file: # open in a text mode
290+
content = file.read()
291+
assert type(content) == str # noqa: E721
292+
return content
294293

295294
def _read__binary(self, filename):
296295
assert type(filename) == str # noqa: E721

0 commit comments

Comments
 (0)