From 9137da5483c9dddc62f3e7ab639151c3d4472c44 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Fri, 30 Apr 2021 10:16:41 -0400 Subject: [PATCH] Stick to Unicode when possible. --- src/allmydata/scripts/tahoe_check.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/allmydata/scripts/tahoe_check.py b/src/allmydata/scripts/tahoe_check.py index d8b7c9bce..494c1dba3 100644 --- a/src/allmydata/scripts/tahoe_check.py +++ b/src/allmydata/scripts/tahoe_check.py @@ -53,14 +53,11 @@ def check_location(options, where): if resp.status != 200: print(format_http_error("ERROR", resp), file=stderr) return 1 - jdata = resp.read() + jdata = resp.read().decode() + if options.get("raw"): - if PY3: - stdoutb = stdout.buffer - else: - stdoutb = stdout - stdoutb.write(jdata) - stdoutb.write(b"\n") + stdout.write(jdata) + stdout.write("\n") return 0 data = json.loads(jdata) @@ -323,17 +320,12 @@ class DeepCheckStreamer(LineOnlyReceiver, object): return 1 # use Twisted to split this into lines - if PY3: - stdoutb = stdout.buffer - else: - stdoutb = stdout - while True: chunk = resp.read(100) if not chunk: break if self.options["raw"]: - stdoutb.write(chunk) + stdout.write(chunk.decode()) else: output.dataReceived(chunk) if not self.options["raw"]: