HibiKier / zhenxun_bot

基于 Nonebot2 开发,以 postgresql 作为数据库,非常可爱的绪山真寻bot
GNU Affero General Public License v3.0
3.3k stars 604 forks source link

初次运行真寻报错 #1524

Closed willater closed 6 months ago

willater commented 6 months ago

系统版本:windows

错误截图

image

日志截图

03-02 01:11:36 [SUCCESS] nonebot | NoneBot is initializing... Traceback (most recent call last): File "D:\bot\zhenxun_bot-0.1.6.7\bot.py", line 5, in nonebot.init() File "C:\Users\willater\anaconda3\envs\zhenxun\lib\site-packages\nonebot__init.py", line 298, in init config = Config( File "C:\Users\willater\anaconda3\envs\zhenxun\lib\site-packages\nonebot\config.py", line 343, in init super().init( File "C:\Users\willater\anaconda3\envs\zhenxun\lib\site-packages\pydantic\main.py", line 171, in init self.pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for Config session_expire_timeout Input should be a valid timedelta, "day" identifier in duration not correctly formatted [type=time_delta_parsing, input_value='30', input_type=str] For further information visit https://errors.pydantic.dev/2.6/v/time_delta_parsing

错误说明

不管是按照教程用poetry还是conda环境,第一次运行真寻都会报这个错

PackageInstaller commented 6 months ago

这个我记得是依赖问题,你装错依赖了,报错是因为env.dev那个超时的30秒设置

willater commented 6 months ago

这个我记得是依赖问题,你装错依赖了,报错是因为env.dev那个超时的30秒设置

重新下载pyproject.toml装了一遍依赖,但是还是不行唉

PackageInstaller commented 6 months ago

反正我也有一次装nb插件的依赖和你一样报错,重装依赖后好了,

willater commented 6 months ago

反正我也有一次装nb插件的依赖和你一样报错,重装依赖后好了,

唉,没事谢谢啦,我晚上再试试叭

YoisakiYui commented 6 months ago

找到问题的原因了,是因为pydantic的那个一块代码,Input should be a valid timedelta, "day" identifier in duration not correctly formatted [type=time_delta_parsing, input_value='30', input_type=str],这里的input_value输入的是你.env.dev的SESSION_EXPIRE_TIMEOUT的内容30,你把它改成SESSION_EXPIRE_TIMEOUT= "30d"就可以运行了

willater commented 6 months ago

找到问题的原因了,是因为pydantic的那个一块代码,Input should be a valid timedelta, "day" identifier in duration not correctly formatted [type=time_delta_parsing, input_value='30', input_type=str],这里的input_value输入的是你.env.dev的SESSION_EXPIRE_TIMEOUT的内容30,你把它改成SESSION_EXPIRE_TIMEOUT= "30d"就可以运行了

感谢,改成30d之后成功运行了!

PackageInstaller commented 6 months ago

超时30天可还行(