From patchwork Tue Dec 13 10:37:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 705348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tdGQH49ngz9t1T for ; Tue, 13 Dec 2016 21:38:31 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=6wind-com.20150623.gappssmtp.com header.i=@6wind-com.20150623.gappssmtp.com header.b="rTno67yB"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tdGQH37BpzDw3h for ; Tue, 13 Dec 2016 21:38:31 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=6wind-com.20150623.gappssmtp.com header.i=@6wind-com.20150623.gappssmtp.com header.b="rTno67yB"; dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mail-wj0-x22e.google.com (mail-wj0-x22e.google.com [IPv6:2a00:1450:400c:c01::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tdGPj0rdpzDvhH for ; Tue, 13 Dec 2016 21:38:01 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=6wind-com.20150623.gappssmtp.com header.i=@6wind-com.20150623.gappssmtp.com header.b="rTno67yB"; dkim-atps=neutral Received: by mail-wj0-x22e.google.com with SMTP id tk12so96526512wjb.3 for ; Tue, 13 Dec 2016 02:38:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=gA4kOohrko1esvfspCPijr6RjI+DeTVaFJpxWWP6cFM=; b=rTno67yBXL4Ztc0OXcwWsj4u0eJvfKmbO3xB2y32wnUnStbDssAxp74SdLLHd4ki7C 038OAg4fEyKx0Uqcn7nyJ//0AuAmDhD3fpHENxhX1HyAr4gb5u29WGbSuJS/KDlOezp4 IDd96HMWEQl7ctlc5ytmw7C5ST+ykxr6enoR0I1mbmRwwyqQ4hNr+fJyxCg3v7atr8gO sPqstAITT4xpUAdclk3aJzGEu15k7ge4F8dewszJ+DWOIS7bP7BGFhdoP1+N+PIYHwZ6 pCHCWU+kzFzPnSeOU54zuny0k3cFSvBx3pvQq1RFjEorM0gv1tdDROPwXBZQ6FNqKuEo ocLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gA4kOohrko1esvfspCPijr6RjI+DeTVaFJpxWWP6cFM=; b=i71B4u7BOuyGnrSB2YuKGGdWTElbkIpVuncMEZQs1RoC2c8/MZar5pgJsIXKqO/jDz +RjFMK/YVFLJ9qAhMab/6EvoguqWNPSxYdZDF5yp7Ww0zOu1tZYc9NiKlHqvLhGoK0dW 3DkIMFIIt18c8e4daLmia/ml/w5EQYe9nS2DnsqK0necggifJjkVFuGR0TPmqBILob4U GD/HhyOolZ8D/D9tgYEUwHDuUKb1VyijeunjYd37bUfFzvhHtIB5jAkHjABARyKZdrEm E7RQRpevsu6f5slZ0/xg4NX04Ph/UnOj57ICojVUOYc9K+ZSacA7aKVCXVqv3ZK4lhrh tNew== X-Gm-Message-State: AKaTC03AsLyuJSHZ7BmuspjB1lDx4TQfYDtYGsBU/wOWjs5f0eOxTHkF0UXUvgnvct2d/kRy X-Received: by 10.194.171.104 with SMTP id at8mr84758744wjc.159.1481625478188; Tue, 13 Dec 2016 02:37:58 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id xu5sm61416242wjc.49.2016.12.13.02.37.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Dec 2016 02:37:57 -0800 (PST) From: Thomas Monjalon To: patchwork@lists.ozlabs.org Subject: [PATCH v2 3/3] pwclient: Fix Python 3 encoding of received strings Date: Tue, 13 Dec 2016 11:37:47 +0100 Message-Id: <1481625467-18217-4-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1481625467-18217-1-git-send-email-thomas.monjalon@6wind.com> References: <1481333552-2294-1-git-send-email-thomas.monjalon@6wind.com> <1481625467-18217-1-git-send-email-thomas.monjalon@6wind.com> X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" The conversion encode("utf-8") makes a byte stream which is poorly printed with Python 3. However this encoding is required for Popen.communicate() but must be done after str.join() which applies to a real string. Signed-off-by: Thomas Monjalon Reviewed-by: Stephen Finucane --- patchwork/bin/pwclient | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient index 660ed76..7ea8878 100755 --- a/patchwork/bin/pwclient +++ b/patchwork/bin/pwclient @@ -269,7 +269,7 @@ def action_check_info(rpc, check_id): print(s) print('-' * len(s)) for key, value in sorted(check.items()): - print("- %- 14s: %s" % (key, unicode(value).encode("utf-8"))) + print("- %- 14s: %s" % (key, unicode(value))) def action_check_create(rpc, patch_id, context, state, url, description): @@ -293,7 +293,7 @@ def action_info(rpc, patch_id): print(s) print('-' * len(s)) for key, value in sorted(patch.items()): - print("- %- 14s: %s" % (key, unicode(value).encode("utf-8"))) + print("- %- 14s: %s" % (key, unicode(value))) def action_get(rpc, patch_id): @@ -311,7 +311,7 @@ def action_get(rpc, patch_id): i += 1 with open(fname, 'w') as f: - f.write(unicode(s).encode("utf-8")) + f.write(unicode(s)) print('Saved patch to %s' % fname) @@ -748,15 +748,15 @@ def main(): for patch_id in non_empty(h, patch_ids): s = rpc.patch_get_mbox(patch_id) if len(s) > 0: - i.append(unicode(s).encode("utf-8")) + i.append(unicode(s)) if len(i) > 0: - pager.communicate(input="\n".join(i)) + pager.communicate(input="\n".join(i).encode("utf-8")) pager.stdin.close() else: for patch_id in non_empty(h, patch_ids): s = rpc.patch_get_mbox(patch_id) if len(s) > 0: - print(unicode(s).encode("utf-8")) + print(unicode(s)) elif action == 'info': for patch_id in non_empty(h, patch_ids):