From 2ed4cff3fa6484be729435a2a1a837222c8e5082 Mon Sep 17 00:00:00 2001 From: omg2hei Date: Thu, 30 Mar 2017 17:15:51 +0800 Subject: [PATCH] fix : AttributeError in Python3 fix : run python weixin.py then AttributeError: 'str' object has no attribute 'decode' --- weixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weixin.py b/weixin.py index 7088558..e3b48e4 100755 --- a/weixin.py +++ b/weixin.py @@ -1161,7 +1161,7 @@ class UnicodeStreamFilter: def write(self, s): if type(s) == str: - s = s.decode('utf-8') + s = s.encode().decode('utf-8') s = s.encode(self.encode_to, self.errors).decode(self.encode_to) self.target.write(s)