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 <[email protected]> --- 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 _______________________________________________ Patchwork mailing list [email protected] https://lists.ozlabs.org/listinfo/patchwork
