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
191 stars 54 forks source link

Connect call failed #19

Open bitcrab opened 4 years ago

bitcrab commented 4 years ago

after I run the ding-dong-bot.py I get below msg:

2020-06-26 22:26:21,862 - Wechaty - INFO - on() listen event <scan> with <<function on_scan at 0x106faaee0>>
2020-06-26 22:26:21,862 - Wechaty - INFO - on() listen event <login> with <<function on_login at 0x107e37ca0>>
2020-06-26 22:26:21,862 - Wechaty - INFO - on() listen event <message> with <<function on_message at 0x106ee0550>>
2020-06-26 22:26:21,862 - Wechaty - INFO - init_puppet_event_bridge() <<wechaty_puppet_hostie.puppet.HostiePuppet object at 0x107ea5160>>
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(dong) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(error) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(heart-beat) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(ready) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - receive <reset> event <%s>
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(reset) (listenerCount:0) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(friendship) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(login) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(logout) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(message) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-invite) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-join) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-leave) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-topic) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - initPuppetEventBridge() puppet.on(scan) (listenerCount:1) registering...
2020-06-26 22:26:21,863 - Wechaty - INFO - starting ...
2020-06-26 22:26:21,863 - HostiePuppet - INFO - init puppet
2020-06-26 22:26:23,511 - HostiePuppet - INFO - init puppet hostie
2020-06-26 22:26:23,512 - HostiePuppet - INFO - starting the puppet ...
Traceback (most recent call last):
  File "/Users/bitcrab/python-wechaty-getting-started/examples/ding-dong-bot.py", line 84, in <module>
    asyncio.run(main())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/Users/bitcrab/python-wechaty-getting-started/examples/ding-dong-bot.py", line 79, in main
    await bot.start()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wechaty/wechaty.py", line 374, in start
    await self.puppet.start()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/wechaty_puppet_hostie/puppet.py", line 879, in start
    await self.puppet_stub.start()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chatie_grpc/wechaty.py", line 650, in start
    return await self._unary_unary("/wechaty.Puppet/Start", request, StartResponse,)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/betterproto/__init__.py", line 1123, in _unary_unary
    await stream.send_message(request, end=True)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpclib/client.py", line 241, in send_message
    await self.send_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpclib/client.py", line 173, in send_request
    protocol = await self._channel.__connect__()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpclib/client.py", line 696, in __connect__
    self._protocol = await self._create_connection()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/grpclib/client.py", line 679, in _create_connection
    _, protocol = await self._loop.create_connection(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
    raise exceptions[0]
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
    sock = await self._connect_sock(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
    await self.sock_connect(sock, address)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
    return await fut
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 60] **Connect call failed ('47.75.97.180', 8788)**

after I run the following script

docker run \
  --rm \
  -ti \
  -e WECHATY_LOG="$WECHATY_LOG" \
  -e WECHATY_PUPPET="$WECHATY_PUPPET" \
  -e WECHATY_PUPPET_PADPLUS_TOKEN="$WECHATY_PUPPET_PADPLUS_TOKEN" \
  -e WECHATY_HOSTIE_PORT="$WECHATY_HOSTIE_PORT" \
  -e WECHATY_TOKEN="$WECHATY_PUPPET_PADPLUS_TOKEN" \
  -p "$WECHATY_HOSTIE_PORT:$WECHATY_HOSTIE_PORT" \
  zixia/wechaty

I get endless err msg as below :

14:31:21 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:31:51 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:32:21 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:32:51 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:33:21 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:33:52 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:34:21 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:34:21 INFO PadplusManager 
            =================================================
            QRCODE_SCAN MSG : 二维码已过期!
            =================================================

14:34:21 INFO IoClient [5] 
14:34:22 INFO IoClient [2] http://weixin.qq.com/x/YaQS3hQLVo7Md4EbWruI
14:34:52 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:35:22 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:35:52 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.
14:36:23 VERB PadplusManager setContactAndRoomData() can not proceed due to no cache.

it seems I cannot connect to the remote host:

JerrydeMacBook-Pro:~ bitcrab$ telnet 47.75.97.180 8788
Trying 47.75.97.180...
telnet: connect to address 47.75.97.180: Operation timed out
telnet: Unable to connect to remote host

what's wrong? please suggest.

bitcrab commented 4 years ago

installed version: wechaty 0.5.dev2 wechaty-puppet 0.0.8 wechaty-puppet-hostie 0.2.5

wj-Mcat commented 4 years ago
TimeoutError: [Errno 60] **Connect call failed ('47.75.97.180', 8788)**

This error dependes your network status, so you can try it later. If there's still a problem, please tell us dig into this problem.

univerone commented 4 years ago

Make sure the port 8788 of your server is accessible , maybe you should modify firewall settings depending on your server provider.

there links may help if your server company is Aliyun: https://www.jianshu.com/p/fc9012820f08 https://help.aliyun.com/document_detail/25471.html

bitcrab commented 4 years ago
TimeoutError: [Errno 60] **Connect call failed ('47.75.97.180', 8788)**

This error dependes your network status, so you can try it later. If there's still a problem, please tell us dig into this problem.

tried several times, still the same problem, now it is:

TimeoutError: [Errno 60] Connect call failed ('117.143.102.77', 8788)

@univerone I am now testing from my local MacBook, so I think the problem is irrelevant to aliyun.

univerone commented 4 years ago

@bitcrab you need a public IP which local devices may not provide, I think maybe you need to run docker image on remote host with relevant firewall settings to make the port accessible.

bitcrab commented 4 years ago

@bitcrab you need a public IP which local devices may not provide, I think maybe you need to run docker image on remote host with relevant firewall settings to make the port accessible.

here is python-wechaty-getting-started for beginner, do you mean the beginner need to deploy the puppet service on remote host when he just want to see how wechaty work by running ding-dong-bot.py?