[PATCH] Fix pwclient get on Python 2
Daniel Axtens
dja at axtens.net
Mon May 22 21:41:43 AEST 2017
Forcibly convert to unicode on Python 2 only.
This makes 'pwclient get' work on both Python 2 and Python 3.
Signed-off-by: Daniel Axtens <dja at axtens.net>
---
patchwork/bin/pwclient | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
index 5fcb0844b923..8c26fdb6d876 100755
--- a/patchwork/bin/pwclient
+++ b/patchwork/bin/pwclient
@@ -303,6 +303,11 @@ def action_get(rpc, patch_id):
fname = "%s.%d" % (base_fname, i)
i += 1
+ try:
+ s = unicode(s)
+ except NameError:
+ pass
+
with io.open(fname, 'w', encoding='utf-8') as f:
f.write(s)
print('Saved patch to %s' % fname)
--
2.11.0
More information about the Patchwork
mailing list