kexue-z / nonebot-plugin-heweather

MIT License
63 stars 11 forks source link

可以适配云崽的py插件吗 #45

Closed lintonxue00 closed 1 year ago

lintonxue00 commented 1 year ago

b750032a_12541690 添加该插件会让py插件不能启动,所有依赖都装了,也没有报错就是卡顿到这步

lintonxue00 commented 1 year ago

我刚开始以为问题是glibc2.28没有安装,安装过好几次但都没有用,,py插件每次启动都没有反应只有把和风插件移走

kexue-z commented 1 year ago

让我猜。。你没有装中文字体

lintonxue00 commented 1 year ago

已经可以运行了,不过经常报网络错误,这个对节点的要求是不是很高呀,我chatgpt机器人的api都可以响应,但是这个经常报超时错误,我发现用香港的节点情况会好点。美国的节点基本不会响应await handler( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_pluginheweather/init.py", line 43, in await w_data.load_data() File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_heweather/weather_data.py", line 62, in load_data self.now, self.daily, self.air, self.warning = await asyncio.gather( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_heweather/weather_data.py", line 119, in _daily res = await self._get_data( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_heweather/weather_data.py", line 69, in _get_data res = await client.get(url, params=params) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1757, in get return await self.request( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1533, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1620, in send response = await self._send_handling_auth( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1648, in _send_handling_auth response = await self._send_handling_redirects( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1685, in _send_handling_redirects response = await self._send_single_request(request) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_client.py", line 1722, in _send_single_request response = await transport.handle_async_request(request) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request resp = await self._pool.handle_async_request(req) File "/usr/local/lib/python3.9/contextlib.py", line 137, in exit self.gen.throw(typ, value, traceback) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectTimeout

lintonxue00 commented 1 year ago

还有像问国外天气也会报错,这是报错内容[PyBot][09:02:52.976][ERROR] [message]Running Matcher(type='message', module=nonebot_plugin_heweather) failed. Traceback (most recent call last): File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 141, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/message.py", line 187, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run await handler( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_pluginheweather/init.py", line 43, in await w_data.load_data() File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_heweather/weather_data.py", line 62, in load_data self.now, self.daily, self.air, self.warning = await asyncio.gather( File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/nonebot_plugin_heweather/weather_data.py", line 142, in _warning return WarningApi(res.json()) File "/root/.cache/pypoetry/virtualenvs/py-plugin-8_cve6GP-py3.9/lib/python3.9/site-packages/pydantic/main.py", line 341, in init raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for WarningApi warning field required (type=value_error.missing) 分析报错

lintonxue00 commented 1 year ago

这是我问chatgpt他告诉我的,这是一个 Python 的报错信息。从报错信息中可以看出,程序执行了一个名为 Matcher 的对象,并且该对象属于 nonebot_plugin_heweather 模块。该 Matcher 对象在运行过程中出现了错误,导致程序抛出了一个 pydantic.error_wrappers.ValidationError 异常。

在具体的异常信息中,可以看到 ValidationError 的原因是一个字段缺失,具体来说,是 WarningApi 中的 warning 字段缺失,这导致了一个 value_error.missing 类型的错误。

至于导致这个错误的原因,则需要查看具体的代码实现,特别是 nonebot_plugin_heweather 模块的代码。

lintonxue00 commented 1 year ago

这个报网络超时错误真的高,5次报4次左右

lintonxue00 commented 1 year ago

请问能增长响应时间吗

kexue-z commented 1 year ago

是不是你的网络环境的问题。我这边怎么试都没有出现