From 089c07689fe67300354ca0b8377e0b76866edace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=B8=96=E9=BE=99?= Date: Fri, 21 Oct 2016 16:06:16 +0800 Subject: [PATCH 1/2] use thread instead of multiprocessing in window system --- weixin.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/weixin.py b/weixin.py index 240a7f0..714d7b1 100755 --- a/weixin.py +++ b/weixin.py @@ -958,8 +958,12 @@ class WebWeixin(object): print '[*] 自动回复模式 ... 关闭' logging.debug('[*] 自动回复模式 ... 关闭') - listenProcess = multiprocessing.Process(target=self.listenMsgMode) - listenProcess.start() + if sys.platform.startswith('win'): + import thread + thread.start_new_thread(self.listenMsgMode()) + else: + listenProcess = multiprocessing.Process(target=self.listenMsgMode) + listenProcess.start() while True: text = raw_input('') From ff3d0abec672b2b3f03ae079d6e71324f1da8e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=B8=96=E9=BE=99?= Date: Fri, 21 Oct 2016 16:44:29 +0800 Subject: [PATCH 2/2] delete colorlogs in window system --- weixin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weixin.py b/weixin.py index 714d7b1..bc1f4a2 100755 --- a/weixin.py +++ b/weixin.py @@ -1151,10 +1151,10 @@ if sys.stdout.encoding == 'cp936': if __name__ == '__main__': - logger = logging.getLogger(__name__) - import coloredlogs - coloredlogs.install(level='DEBUG') + if not sys.platform.startswith('win'): + import coloredlogs + coloredlogs.install(level='DEBUG') webwx = WebWeixin() webwx.start()