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

[BUG] AttributeError: 'NoneType' object has no attribute 'group' #1081

Closed
magician-m opened this issue Jul 23, 2023 · 4 comments · Fixed by #1097
Closed

[BUG] AttributeError: 'NoneType' object has no attribute 'group' #1081

magician-m opened this issue Jul 23, 2023 · 4 comments · Fixed by #1097
Labels
bug Something isn't working

Comments

@magician-m
Copy link

提交 issue 前,请先确认:

  • [√] 我已看过 FAQ,此问题不在列表中
  • [√ ] 我已看过其他 issue,他们不能解决我的问题
  • [ √] 我认为这不是 Mirai 或者 OpenAI 的 BUG

表现
AttributeError: 'NoneType' object has no attribute 'group'

运行环境:

  • 操作系统:win10
  • Docker: 无
  • 项目版本:最新2.5.2

复现步骤
描述你是如何触发这个 BUG 的
1.我一开始是全流程都成功过的,并且能够在qq里正常对话和语音输出
2.但后来我就在另一个环境py3.10中安装了edge-tts,按道理是不会对本项目环境造成任何影响的
3.现在我经过重新安装本项目,甚至更换一台电脑后仍是以下问题。
4.我的配置文件也已经经过详细修改,但没有作用。

预期行为
应该完美运行。

日志
Active code page: 65001
2023-07-23 22:22:55.788 | SUCCESS | config:scan_presets:557 - 检查预设:聊天 <==> presets/issue402.txt [成功]
2023-07-23 22:22:55.788 | SUCCESS | config:scan_presets:557 - 检查预设:猫娘 <==> presets/catgirl.txt [成功]
2023-07-23 22:22:55.788 | SUCCESS | config:scan_presets:570 - 注册预设:bing <==> ./presets\assistant\bing.txt [成功]
2023-07-23 22:22:55.788 | SUCCESS | config:scan_presets:570 - 注册预设:dan <==> ./presets\assistant\dan.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:debater <==> ./presets\assistant\debater.txt [ 成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:kp <==> ./presets\assistant\kp.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:lawyer <==> ./presets\assistant\lawyer.txt [成 功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:long <==> ./presets\assistant\long.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:Lss233 <==> ./presets\assistant\Lss233.txt [成 功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:novelist <==> ./presets\assistant\novelist.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:poet <==> ./presets\assistant\poet.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:shineisheji <==> ./presets\assistant\shineisheji.txt [成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:catgirl <==> ./presets\role-play\catgirl.txt [ 成功]
2023-07-23 22:22:55.798 | SUCCESS | config:scan_presets:570 - 注册预设:cixiaogui <==> ./presets\role-play\cixiaogui.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:crazy <==> ./presets\role-play\crazy.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:debatestick <==> ./presets\role-play\debatestick.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:dingzhen <==> ./presets\role-play\dingzhen.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:DJ <==> ./presets\role-play\DJ.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:ERNIE <==> ./presets\role-play\ERNIE.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:gaoqiqiang <==> ./presets\role-play\gaoqiqiang.txt [成功]
2023-07-23 22:22:55.808 | SUCCESS | config:scan_presets:570 - 注册预设:hanli <==> ./presets\role-play\hanli.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:huxijin <==> ./presets\role-play\huxijin.txt [ 成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:ikun <==> ./presets\role-play\ikun.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:jiabaili <==> ./presets\role-play\jiabaili.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:linruolan <==> ./presets\role-play\linruolan.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:MOSS <==> ./presets\role-play\MOSS.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:PG13succubus <==> ./presets\role-play\PG13succubus.txt [成功]
2023-07-23 22:22:55.818 | SUCCESS | config:scan_presets:570 - 注册预设:powanlang <==> ./presets\role-play\powanlang.txt [成功]
2023-07-23 22:22:55.828 | SUCCESS | config:scan_presets:570 - 注册预设:TsundereCatgirl <==> ./presets\role-play\TsundereCatgirl.txt [成功]
2023-07-23 22:22:55.828 | SUCCESS | config:scan_presets:570 - 注册预设:welldone <==> ./presets\role-play\welldone.txt [成功]
2023-07-23 22:22:55.828 | SUCCESS | config:scan_presets:570 - 注册预设:yutao <==> ./presets\role-play\yutao.txt [成功]
2023-07-23 22:22:55.838 | SUCCESS | config:scan_presets:570 - 注册预设:zhangweiwei <==> ./presets\role-play\zhangweiwei.txt [成功]
2023-07-23 22:22:55.838 | ERROR | config:scan_presets:567 - 注册预设:dan <==> ./presets\utils\dan.txt [失败:关键词 已存在]
2023-07-23 22:22:55.838 | ERROR | config:scan_presets:567 - 注册预设:catgirl <==> ./presets\catgirl.txt [失败:关键 词已存在]
2023-07-23 22:22:55.838 | SUCCESS | config:scan_presets:570 - 注册预设:catgirl_en <==> ./presets\catgirl_en.txt [成功]
2023-07-23 22:22:55.838 | SUCCESS | config:scan_presets:570 - 注册预设:issue402 <==> ./presets\issue402.txt [成功]
2023-07-23 22:22:55.838 | SUCCESS | config:scan_presets:570 - 注册预设:预设模板 <==> ./presets\预设模板.txt [成功]
2023-07-23 22:22:55.928 | INFO | manager.bot:login_poe:274 - 正在解析第 1 个 poe web 账号
2023-07-23 22:22:55.928 | INFO | manager.bot:__check_proxy:393 - [代理测试] 正在检查代理配置:http://127.0.0.1:10809
2023-07-23 22:23:00.237 | SUCCESS | manager.bot:__check_proxy:401 - [代理测试] 连接成功!
2023-07-23 22:23:03.762 | ERROR | manager.bot:login_poe:282 - 解析失败:
2023-07-23 22:23:03.764 | ERROR | manager.bot:login_poe:283 - 'NoneType' object has no attribute 'group'
Traceback (most recent call last):

File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\chatgpt\bot.py", line 17, in
loop.run_until_complete(botManager.login())
│ │ │ └ <function BotManager.login at 0x0000012348641D00>
│ │ └ <manager.bot.BotManager object at 0x000001234846B210>
│ └ <function BaseEventLoop.run_until_complete at 0x0000012321039440>

File "asyncio\base_events.py", line 640, in run_until_complete
sock.setblocking(False)

File "asyncio\windows_events.py", line 321, in run_forever

File "asyncio\base_events.py", line 607, in run_forever
sock.close()

File "asyncio\base_events.py", line 1922, in _run_once

File "asyncio\events.py", line 80, in _run
self._loop = loop
│ └ <member '_loop' of 'Handle' objects>
└ <Handle <TaskStepMethWrapper object at 0x0000012348741270>()>

File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\chatgpt\manager\bot.py", line 109, in login
self.login_poe()
│ └ <function BotManager.login_poe at 0x0000012348642840>
└ <manager.bot.BotManager object at 0x000001234846B210>

File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\chatgpt\manager\bot.py", line 277, in login_poe
bot = PoeClient(token=account.p_b, proxy=account.proxy)
│ │ │ │ └ 'http://127.0.0.1:10809'
│ │ │ └ PoeCookieAuth(p_b='iNe8-gL3j7sWp5vArdXXQg%3D%3D', proxy='http://127.0.0.1:10809')
│ │ └ 'iNe8-gL3j7sWp5vArdXXQg%3D%3D'
│ └ PoeCookieAuth(p_b='iNe8-gL3j7sWp5vArdXXQg%3D%3D', proxy='http://127.0.0.1:10809')
└ <class 'poe.Client'>

File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\Lib\site-packages\poe.py", line 152, in init
self.connect_ws()
│ └ <function Client.connect_ws at 0x0000012322F5CCC0>
└ <poe.Client object at 0x00000123497D40D0>
File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\Lib\site-packages\poe.py", line 405, in connect_ws
self.setup_connection()
│ └ <function Client.setup_connection at 0x0000012322F5C360>
└ <poe.Client object at 0x00000123497D40D0>
File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\Lib\site-packages\poe.py", line 178, in setup_connection
self.next_data = self.get_next_data(overwrite_vars=True)
│ │ └ <function Client.get_next_data at 0x0000012322F5C540>
│ └ <poe.Client object at 0x00000123497D40D0>
└ <poe.Client object at 0x00000123497D40D0>
File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\Lib\site-packages\poe.py", line 226, in get_next_data
self.formkey = self.extract_formkey(r.text)
│ │ │ │ └ '<title>Assistant - Poe</title><meta name="descripti...
│ │ │ └ <Response [200]>
│ │ └ <function Client.extract_formkey at 0x0000012322F5C4A0>
│ └ <poe.Client object at 0x00000123497D40D0>
└ <poe.Client object at 0x00000123497D40D0>
File "E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\Lib\site-packages\poe.py", line 203, in extract_formkey
script_text = re.search(script_regex, html).group(1)
│ │ │ └ '<title>Assistant - Poe</title><meta name="descripti...
│ │ └ '<script>(.+)function\(\){return .\.join\(""\)};</script>'
│ └ <function search at 0x000001231ED22D40>
└ <module 're' from 'E:\Browser_download_file\Windows-quickstart-refs.tags.v2.5.2\python3.11\python311.zip\re\init.pyc'>

AttributeError: 'NoneType' object has no attribute 'group'
2023-07-23 22:23:03.800 | ERROR | manager.bot:login_poe:285 - 所有 Poe 账号均解析失败!
2023-07-23 22:23:03.800 | SUCCESS | manager.bot:login_poe:286 - 成功解析 0/1 个 poe web 账号!
2023-07-23 22:23:03.801 | ERROR | manager.bot:login:155 - 没有登录成功的账号,程序无法启动!

@magician-m magician-m added the bug Something isn't working label Jul 23, 2023
@magician-m magician-m changed the title [BUG] 请填写标题 [BUG] AttributeError: 'NoneType' object has no attribute 'group' Jul 23, 2023
@baishiwei007
Copy link

部署到国外服务器出现同样问题NoneType
chatgpt-qq-chatgpt-1 | self.next_data = self.get_next_data(overwrite_vars=True)
chatgpt-qq-chatgpt-1 | │ │ └ <function Client.get_next_data at 0x7f80683e4cc0>
chatgpt-qq-chatgpt-1 | │ └ <poe.Client object at 0x7f806423d550>
chatgpt-qq-chatgpt-1 | └ <poe.Client object at 0x7f806423d550>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.11/site-packages/poe.py", line 223, in get_next_data
chatgpt-qq-chatgpt-1 | r = request_with_retries(self.session.get, self.home_url)
chatgpt-qq-chatgpt-1 | │ │ │ │ │ └ 'https://poe.com'
chatgpt-qq-chatgpt-1 | │ │ │ │ └ <poe.Client object at 0x7f806423d550>
chatgpt-qq-chatgpt-1 | │ │ │ └ <function Session.get at 0x7f80683863e0>
chatgpt-qq-chatgpt-1 | │ │ └ <tls_client.sessions.Session object at 0x7f806423d690>
chatgpt-qq-chatgpt-1 | │ └ <poe.Client object at 0x7f806423d550>
chatgpt-qq-chatgpt-1 | └ <function request_with_retries at 0x7f806834e020>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.11/site-packages/poe.py", line 82, in request_with_retries
chatgpt-qq-chatgpt-1 | raise RuntimeError(f"Failed to download {url} too many times.")
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | RuntimeError: Failed to download https://poe.com too many times.
chatgpt-qq-chatgpt-1 | 2023-07-26 15:11:34.689 | ERROR | manager.bot:login_poe:296 - 所有 Poe 账号均解析失败!
chatgpt-qq-chatgpt-1 | 2023-07-26 15:11:34.689 | SUCCESS | manager.bot:login_poe:297 - 成功解析 0/1 个 poe web 账号!
chatgpt-qq-chatgpt-1 | 2023-07-26 15:11:34.690 | ERROR | manager.bot:login:169 - 没有登录成功的账号,程序无法启动!

但是我发现这个raise RuntimeError(f"Failed to download {url} too many times.")
怀疑一开始cfg没配置正确,docker循环请求给poe短暂屏蔽了?
我的cfg简单不知道有无毛病:
`
[onebot]
qq=9589-----6
manager_qq=330----65

reverse_ws_port = 8554

[poe]
[[poe.accounts]]
p_b = "ny-----r-------=="
`
后续能否在日志中显示配置文件
我照着视频教程从win下拷贝过俩文件,应该是登录qq用的,日志显示qq登录正常
只有poe解析不到

@qrzbing
Copy link
Contributor

qrzbing commented Jul 29, 2023

我也遇到了这个问题。我是在本地笔记本上部署的,另外你似乎泄露了 Poe Token。

@qrzbing
Copy link
Contributor

qrzbing commented Jul 29, 2023

看了一下是上游 poe-api 的问题,他们也讨论了这件事:ading2210/poe-api#202

我看了一眼依赖里面的 poe-api 版本是 0.4.11:

poe-api~=0.4.11
,感觉可以尝试更新到上游最新版 0.4.17。不过我看 docker 版本发布也就一天前,所以我感觉更新依赖版本可能也不会解决问题。

@qrzbing
Copy link
Contributor

qrzbing commented Jul 29, 2023

OK,我知道是什么情况了,我在本地 build 了一个 docker,发现确实是依赖没有更新到最新版导致的。在更新到最新的 poe-api 时会安装 quick-js,它在 build 时会调用 gcc,因此除了更新依赖外,还需要在 Dockerfile 中添加一条 build-essential 的指令。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants