wechaty / python-wechaty-getting-started

Python Wechaty Starter Project Template that Works Out-of-the-Box
https://gitpod.io/#https://github.com/wechaty/python-wechaty-getting-started
Apache License 2.0
184 stars 54 forks source link

Keep waiting at bot.start() #16

Open inkpool opened 4 years ago

inkpool commented 4 years ago

My program keeps waiting at bot.start(). I can only see log at 2020-06-19 21:49:05,481 - Wechaty - INFO - starting ... No text is printed after bot.start(). No error is reported. The bot cannot catch any incoming message.

Here are some of the details and my questions: I have successfully run with python-wechaty a few days ago. But I got kicked. This time when I ran the bot no qrcode scan is needed nor other login operation is needed. I feel strange about this, I should re-login into the bot. Is there any context(cookie, session) stored by wechaty IDC? How can I remove the previous login context and do a complete reset?

PS. I am using the donut token.

wj-Mcat commented 4 years ago

You can try to logout befor login. In this way, you can remove login status befor login to get the right login process. If you also occur problem, please continue to put the error at this issue. Looking forward to hear good news.

inkpool commented 4 years ago

You can try to logout befor login. In this way, you can remove login status befor login to get the right login process. If you also occur problem, please continue to put the error at this issue. Looking forward to hear good news.

How to logout? I have tried bot.stop(). Also, I have tried to logout from my cellphone side. The problem remains.

inkpool commented 4 years ago

Also, I have tried the gateway server to convert the padplus_token to donut_token by myself. https://api.chatie.io/v0/hosties/my_token I can see my public IP and port here. But my client got error:

Traceback (most recent call last): File "/Users/mochi/Dropbox/working_projects/stock_alert/wechaty/MyBot.py", line 110, in asyncio.run(main()) File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/runners.py", line 43, in run return loop.run_until_complete(main) File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete return future.result() File "/Users/mochi/Dropbox/working_projects/stock_alert/wechaty/MyBot.py", line 106, in main await bot.start() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/wechaty/wechaty.py", line 343, in start await self.puppet.start() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/wechaty_puppet_hostie/puppet.py", line 766, in start await self.puppet_stub.stop() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/chatie_grpc/wechaty.py", line 655, in stop return await self._unary_unary("/wechaty.Puppet/Stop", request, StopResponse,) File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/betterproto/init.py", line 1123, in _unary_unary await stream.send_message(request, end=True) File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/grpclib/client.py", line 241, in send_message await self.send_request() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/grpclib/client.py", line 173, in send_request protocol = await self._channel.connect() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/grpclib/client.py", line 696, in connect self._protocol = await self._create_connection() File "/Users/mochi/.local/share/virtualenvs/stock_alert-QrE978-C/lib/python3.7/site-packages/grpclib/client.py", line 681, in _create_connection ssl=self._ssl, File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 958, in create_connection raise exceptions[0] File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 945, in create_connection await self.sock_connect(sock, address) File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect return await fut File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 60] Connect call failed ('xxx.xxx.xxx.xxx(my server ip)', 9001)

wj-Mcat commented 4 years ago

It seems that you can't connect to the server. The output log only show starting the puppet which means that connecting is a problem. You said that you can see your public IP, can you see the hostie-server ip address and port ? If it is, can you get ping command run well ?

inkpool commented 4 years ago

Also, I have tried the gateway server to convert the padplus_token to donut_token by myself. https://api.chatie.io/v0/hosties/my_token I can see my public IP and port here. But my client got error:

return await fut File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') TimeoutError: [Errno 60] Connect call failed ('xxx.xxx.xxx.xxx(my server ip)', 9001)

It seems that you can't connect to the server. The output log only show starting the puppet which means that connecting is a problem. You said that you can see your public IP, can you see the hostie-server ip address and port ? If it is, can you get ping command run well ?

Sorry. It seems my FW has blocked the 9001. After I converted the padplus_token to donut_token, it worked. However, the donut_token provided by official merchant is not working any more.

wj-Mcat commented 4 years ago

@huan we need you to expain the mechanism behind the token.