From 150b0fd3a356f6646b84c9a33b09d972c5eb0db6 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 10 May 2021 10:31:12 -0400 Subject: [PATCH] This code should only run on Python 3. --- src/allmydata/scripts/tahoe_get.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/allmydata/scripts/tahoe_get.py b/src/allmydata/scripts/tahoe_get.py index 769a366a5..150b0457b 100644 --- a/src/allmydata/scripts/tahoe_get.py +++ b/src/allmydata/scripts/tahoe_get.py @@ -1,5 +1,7 @@ from __future__ import print_function +from future.utils import PY3 + from urllib.parse import quote as url_quote from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \ UnknownAliasError @@ -32,7 +34,7 @@ def get(options): outf = stdout # Make sure we can write bytes; on Python 3 stdout is Unicode by # default. - if getattr(outf, "encoding", None) is not None: + if PY3 and getattr(outf, "encoding", None) is not None: outf = outf.buffer while True: data = resp.read(4096)