kexue-z / nonebot-plugin-heweather

MIT License
63 stars 11 forks source link

python3.10.8 环境下尝试格式化12小时制报错 #59

Closed TsukinaKasumi closed 1 year ago

TsukinaKasumi commented 1 year ago

08-24 20:01:23 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_heweather) failed. Traceback (most recent call last): File "", line 17, in File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot__init__.py", line 333, in run get_driver().run(*args, *kwargs) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 199, in run uvicorn.run( File "C:\Users\Administrator\ATRI.venv\lib\site-packages\uvicorn\main.py", line 587, in run server.run() File "C:\Users\Administrator\ATRI.venv\lib\site-packages\uvicorn\server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1899, in _run_once handle._run() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\message.py", line 467, in check_and_run_matcher await _run_matcher(

File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\message.py", line 419, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 759, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 734, in simple_run await handler( File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot\dependencies__init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot_plugin_heweather\init_.py", line 51, in img = await render(w_data) File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot_plugin_heweather\render_pic.py", line 33, in render "hours": add_hour_data(weather.hourly.hourly), File "C:\Users\Administrator\ATRI.venv\lib\site-packages\nonebot_plugin_heweather\render_pic.py", line 48, in add_hour_data hour.hour = date_time.strftime("%-I%p") ValueError: Invalid format string

TsukinaKasumi commented 1 year ago

服务器系统是winserver2022 ,可能是%-|不支持我的系统或者版本,改为 hour.hour = date_time.strftime("%I%p")可以正常渲染出图

Nenot233 commented 1 year ago

08-25 11:41:44 [ERROR] nonebot | Running Matcher(type='message', module=extensive_plugin.nonebot_plugin_heweather) failed. Traceback (most recent call last): File "D:\BOT\zhenxun_bot\bot.py", line 22, in nonebot.run() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot__init.py", line 309, in run get_driver().run(*args, *kwargs) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\drivers\fastapi.py", line 198, in run uvicorn.run( File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 578, in run server.run() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1906, in _run_once handle._run() File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 467, in check_and_run_matcher await _run_matcher( File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 419, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 753, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 728, in simple_run await handler( File "C:\Users\550N\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\dependencies__init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "D:\BOT\zhenxun_bot\extensive_plugin\nonebot_plugin_heweather\init_.py", line 52, in await w_data.load_data() File "D:\BOT\zhenxun_bot\extensive_plugin\nonebot_plugin_heweather\weather_data.py", line 68, in load_data ) = await asyncio.gather( File "D:\BOT\zhenxun_bot\extensive_plugin\nonebot_plugin_heweather\weather_data.py", line 157, in _hourly return HourlyApi(**res.json()) File "pydantic\main.py", line 342, in pydantic.main.BaseModel.init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for HourlyApi hourly field required (type=value_error.missing)

我也报错了

kexue-z commented 1 year ago

试一下最新版本 v0.6.11 用正确的API对应的APITYPE

Nenot233 commented 1 year ago

image 因为插件不怎么更新所以我直接写进config里面

kexue-z commented 1 year ago

建议免费版用0 标准版用1

faithleysath commented 1 year ago

服务器系统是winserver2022 ,可能是%-|不支持我的系统或者版本,改为 hour.hour = date_time.strftime("%I%p")可以正常渲染出图

最新版本已经修复了这行代码的bug了