Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channel切换为wechaty后,编译遇到问题,报错,提示'WechatyChannel' object has no attribute 'handler_pool' #1748

Open
2 tasks done
SamYueHW opened this issue Feb 14, 2024 · 10 comments

Comments

@SamYueHW
Copy link

前置确认

  • 我确认我运行的是最新版本的代码,并且安装了所需的依赖,在FAQS中也未找到类似问题。

⚠️ 搜索issues中是否已存在类似问题

  • 我已经搜索过issues和disscussions,没有跟我遇到的问题相关的issue

操作系统类型?

MacOS

运行的python版本是?

python 3.7

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wxy(个人微信, wechaty)

复现步骤 🕹

No response

问题描述 😯

config.json里已经改为
"channel_type": "wxy",
”wechaty_puppet_service_token": "puppet_padlocal_d6。。。“

终端日志 📒

[INFO][2024-02-14 23:18:09][role.py:69] - [Role] inited
[INFO][2024-02-14 23:18:09][dungeon.py:56] - [Dungeon] inited
[INFO][2024-02-14 23:18:09][hello.py:24] - [Hello] inited
[INFO][2024-02-14 23:18:09][finish.py:23] - [Finish] inited
[ERROR][2024-02-14 23:18:09][app.py:66] - App startup failed!
[ERROR][2024-02-14 23:18:09][app.py:67] - 'WechatyChannel' object has no attribute 'handler_pool'
Traceback (most recent call last):
  File "/Users/samuelyue/Desktop/Coding/cow/chatgpt-on-wechat/app.py", line 61, in run
    start_channel(channel_name)
  File "/Users/samuelyue/Desktop/Coding/cow/chatgpt-on-wechat/app.py", line 40, in start_channel
    channel.startup()
  File "/Users/samuelyue/Desktop/Coding/cow/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 42, in startup
    asyncio.run(self.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/samuelyue/Desktop/Coding/cow/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 47, in main
    self.handler_pool._initializer = lambda: asyncio.set_event_loop(loop)
AttributeError: 'WechatyChannel' object has no attribute 'handler_pool'
@mashagua
Copy link

我也遇到了,解决了吗

@SamYueHW
Copy link
Author

SamYueHW commented Feb 19, 2024 via email

@fireStarGXZ
Copy link

我也出现这个问题了
[ERROR][2024-02-29 21:48:31][app.py:66] - App startup failed!
[ERROR][2024-02-29 21:48:31][app.py:67] - 'WechatyChannel' object has no attribute 'handler_pool'
Traceback (most recent call last):
File "/root/chatgpt-on-wechat/app.py", line 61, in run
start_channel(channel_name)
File "/root/chatgpt-on-wechat/app.py", line 40, in start_channel
channel.startup()
File "/root/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 42, in startup
asyncio.run(self.main())
File "/usr/lib64/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/root/chatgpt-on-wechat/channel/wechat/wechaty_channel.py", line 47, in main
self.handler_pool._initializer = lambda: asyncio.set_event_loop(loop)
AttributeError: 'WechatyChannel' object has no attribute 'handler_pool'

@felixiao
Copy link

felixiao commented Mar 1, 2024

遇到同样问题,有人知道怎么解决嘛?还有wechaty的个微的token是要去买嘛?免费的只有7天时间

@mashagua
Copy link

mashagua commented Mar 2, 2024

遇到同样问题,有人知道怎么解决嘛?还有wechaty的个微的token是要去买嘛?免费的只有7天时间

对,是要去买,一个月200,一年的话打5折,这个就是不知道它对应的wechaty的版本是哪个,没有写在requirements.txt里,最新装的好像没有那个属性

@gattaca2017
Copy link

gattaca2017 commented Mar 30, 2024

from channel.chat_channel import ChatChannel, handler_pool   # add 

class WechatyChannel(ChatChannel):
    NOT_SUPPORT_REPLYTYPE = []

    def __init__(self):
        super().__init__()
        self.handler_pool = handler_pool    # add this line

@kvgary
Copy link

kvgary commented Apr 7, 2024

@SamYueHW 问题解决了吗?

PinkPanther-ny added a commit to PinkPanther-ny/chatgpt-on-wechat that referenced this issue Apr 9, 2024
Fix this issue: 'WechatyChannel' object has no attribute 'handler_pool'
zhayujie#1748
PinkPanther-ny added a commit to PinkPanther-ny/chatgpt-on-wechat that referenced this issue Apr 9, 2024
… Update chat_channel.py

zhayujie#1748
Fix issue, 'WechatyChannel' object has no attribute 'handler_pool'
@PinkPanther-ny
Copy link

已解决,请看我的这个PR
#1884

@mashagua
Copy link

self.handler_pool = handler_pool # add this line

添加了之后原来的问题是没有了,但是出现了
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.10/site-packages/wechaty/wechaty.py", line 445, in start
await self.puppet.start()
File "/root/miniconda3/lib/python3.10/site-packages/wechaty_puppet_service/puppet.py", line 911, in start
self._init_puppet()
File "/root/miniconda3/lib/python3.10/site-packages/wechaty_puppet_service/puppet.py", line 876, in _init_puppet
raise WechatyPuppetGrpcError(
wechaty_puppet.exceptions.WechatyPuppetGrpcError: WechatyPuppetGrpcError('can"t fetch endpoint from chatie server. You can try it later, or make sure that your pc can connect to heroku server ', None, None)

@finexss
Copy link

finexss commented Jun 4, 2024

self.handler_pool = handler_pool # add this line

添加了之后原来的问题是没有了,但是出现了 Traceback (most recent call last): File "/root/miniconda3/lib/python3.10/site-packages/wechaty/wechaty.py", line 445, in start await self.puppet.start() File "/root/miniconda3/lib/python3.10/site-packages/wechaty_puppet_service/puppet.py", line 911, in start self._init_puppet() File "/root/miniconda3/lib/python3.10/site-packages/wechaty_puppet_service/puppet.py", line 876, in _init_puppet raise WechatyPuppetGrpcError( wechaty_puppet.exceptions.WechatyPuppetGrpcError: WechatyPuppetGrpcError('can"t fetch endpoint from chatie server. You can try it later, or make sure that your pc can connect to heroku server ', None, None)

是的,我的也出现了,不知道是不是wechaty的版本不对还是其它什么原因。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants