Closed hakureireimusama closed 1 year ago
你的插件是怎样安装的?
nb plugin install nonebot-plugin-memes
用这条命令安装的
看一下 nonebot2 和 nb-cli 版本
nb-cli 1.1.2
nonebot2 2.0.0rc4
Python 3.10.11
你是用 nb-cli 创建的项目吗?怎么没有虚拟环境
之前创建的有虚拟环境的也报错,就试试看没有虚拟环境的情况会不会报错,发现也会报错
C:\bot\nb2>nb run --reload
使用 Python: C:\bot\nb2.venv\Scripts\python.exe
启动重载监视,当前进程 [4164].
05-04 08:20:28 [SUCCESS] nonebot | NoneBot is initializing...
05-04 08:20:28 [INFO] nonebot | Current Env: prod
05-04 08:20:29 [SUCCESS] nonebot | Succeeded to load plugin "echo" from "nonebot.plugins.echo"
05-04 08:20:30 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_localstore"
05-04 08:20:30 [ERROR] nonebot | Failed to import "nonebot_plugin_memes"
Traceback (most recent call last):
File "
File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\manager.py", line 141, in load_plugin module = importlib.import_module(name) File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\importlib__init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "
", line 1050, in _gcd_import File " init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for Config memes_disabled_list value is not a valid list (type=type_error.list) 05-04 08:20:30 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_emojimix" 05-04 08:20:30 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_withdraw" 05-04 08:20:31 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_apscheduler" 05-04 08:20:31 [INFO] haruka_bot | 检查 Chromium 更新 05-04 08:20:31 [INFO] haruka_bot | 检查 Playwright 依赖 05-04 08:20:33 [SUCCESS] nonebot | Succeeded to load plugin "haruka_bot" 05-04 08:20:35 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_gocqhttp" 05-04 08:20:35 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_htmlrender" 05-04 08:20:35 [SUCCESS] nonebot | Succeeded to load plugin "nonebot_plugin_heweather" 05-04 08:20:35 [SUCCESS] nonebot | Running NoneBot... 05-04 08:20:36 [INFO] uvicorn | Started server process [20520] 05-04 08:20:36 [INFO] uvicorn | Waiting for application startup. 05-04 08:20:36 [INFO] nonebot_plugin_apscheduler | Scheduler Started 05-04 08:20:36 [INFO] nonebot_plugin_gocqhttp | Startup complete, Web UI has served to http://127.0.0.1:10339/go-cqhttp/ 05-04 08:20:36 [INFO] nonebot_plugin_htmlrender | 使用 chromium 启动 05-04 08:20:37 [INFO] nonebot_plugin_htmlrender | Browser Started. 05-04 08:20:37 [INFO] uvicorn | Application startup complete. 05-04 08:20:37 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:10339 (Press CTRL+C to quit)", line 1027, in _find_and_load File " ", line 1006, in _find_and_load_unlocked File " ", line 688, in _load_unlocked File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\manager.py", line 240, in exec_module super().exec_module(module) File " ", line 883, in exec_module File " ", line 241, in _call_with_frames_removed File "C:\bot\nb2.venv\lib\site-packages\nonebot_plugin_memes__init__.py", line 49, in from .config import memes_config File "C:\bot\nb2.venv\lib\site-packages\nonebot_plugin_memes\config.py", line 17, in memes_config = Config.parse_obj(get_driver().config.dict()) File "pydantic\main.py", line 526, in pydantic.main.BaseModel.parse_obj return cls(**obj) File "pydantic\main.py", line 341, in pydantic.main.BaseModel.
这是有虚拟环境的情况,也会报错
你的memes_disabled_list
配置项格式不对
原来如此,本人完全不懂python,想全局禁用“关注”这个表情 memes_disabled_list = [follow] 我是这样写的,应该这么写才符合规范呀~
加引号,如 ["follow"]
好耶,终于不报错了~
05-02 20:31:06 [ERROR] nonebot | Failed to import "nonebot_plugin_memes" Traceback (most recent call last): File "", line 14, in
File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml
return load_all_plugins(plugins, plugin_dirs)
File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins
return manager.load_all_plugins()
File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins
return set(
File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\plugin\manager.py", line 176, in
filter(None, (self.load_plugin(name) for name in self.available_plugins))