You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Wechat Auto Reply logic@itchatmp.msg_register(itchatmp.content.TEXT)deftext_reply(msg):
if(msg['Content'].isdigit() andlen(msg['Content']) ==5):
returnaddjob(msg['FromUserName'],msg['Content'])
WrongCRN= [u'好像没有这个课号呢!课号一般是5位数。',u'难受!没这个课号!再试试其他的吧!',u'逗我呢?',u'你**在给我free style吗?']
returnrandom.choice(WrongCRN)
@itchatmp.access_tokendefproducer(accessToken=None):
while(1):
ifhasUpdated():
itchatmp.send(str(datetime.datetime.now()),'oO3tH0e3rt_j85k3ASkztTBM8Mec')
print('1')
else:
sleep(1)
continue#MultiThread###### main auto reply ######replyThread=threading.Thread(target=itchatmp.run)
# prevent Main Thread to continuereplyThread.setDaemon(True)
# start as DaemonreplyThread.start()
###### producer #####producer=threading.Thread(target=producer)
producer.setDaemon(True)
producer.start()
replyThread.join()
producer.join()
每次都是Update Token以后 第二个thread 会报错
root@chi-us-vu:~/courserader# cat server/py_core/out.log
itchatmp started! press Ctrl+C to exit.
1
1
1
1
1
1
1
1
1
1
1
Access token updated
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/mpapi/base/common.py", line 150, in __access_token
r = fn(*args, **kwargs)
File "./wechat.py", line 47, in producer
itchatmp.send(str(datetime.datetime.now()),'oO3tH0e3rt_j85k3ASkztTBM8Mec')
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/server.py", line 82, in send
return self.wrapped.send(msg, toUserName, mediaId)
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/wrapped.py", line 7, in send
self.core, msg, toUserName, mediaId)
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/common.py", line 23, in determine_wrapper
return tokenFn(mpFn)(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/mpapi/base/common.py", line 145, in __access_token
updateResult = self.update_access_token()
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/mpapi/base/common.py", line 173, in update_access_token
return self._tokenFunction()
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/mpapi/base/common.py", line 68, in _update_access_token
self.maintain_access_token(r)
File "/usr/local/lib/python3.5/dist-packages/itchatmp-0.0.17-py3.5.egg/itchatmp/controllers/mpapi/base/common.py", line 84, in maintain_access_token
t = threading.Thread(target=auto_maintain_thread,
NameError: name 'auto_maintain_thread' is not defined
The text was updated successfully, but these errors were encountered:
更新token以后 会报错
每次都是Update Token以后 第二个thread 会报错
The text was updated successfully, but these errors were encountered: