CMHopeSunshine / nonebot-plugin-learning-chat

Nonebot2插件,让Bot学习群友的发言和表情包。/ Nonebot2 plugin to learn what your group members say.
GNU Affero General Public License v3.0
155 stars 5 forks source link

启动报错TypeError: 'NoneType' object is not iterable #55

Closed MoMorkIsGay closed 4 months ago

MoMorkIsGay commented 9 months ago

以前本插件能够正常运行,某天之后运行nb run产生错误如下: [ERROR] nonebot | Failed to import "nonebot_plugin_learning_chat" Traceback (most recent call last): File "pydantic\main.py", line 522, in pydantic.main.BaseModel.parse_obj obj = dict(obj) TypeError: 'NoneType' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\ARing\nmsl\bot.py", line 14, in nonebot.load_from_toml("pyproject.toml") File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\load.py", line 130, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\load.py", line 64, in load_all_plugins return manager.load_all_plugins() File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in load_all_plugins return set( File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\manager.py", line 177, in filter(None, (self.load_plugin(name) for name in self.available_plugins))

File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\manager.py", line 142, in load_plugin module = importlib.import_module(name) File "C:\Users\ARing\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 "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot\plugin\manager.py", line 242, in exec_module super().exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot_plugin_learning_chat\init.py", line 22, in from .handler import LearningChat File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot_plugin_learning_chat\handler.py", line 17, in from .models import ChatBlackList, ChatContext, ChatAnswer, ChatMessage File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot_plugin_learning_chat\models.py", line 25, in from .config import config_manager File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot_plugin_learning_chat\config.py", line 107, in config_manager = ChatConfigManager() File "C:\Users\ARing\nmsl.venv\lib\site-packages\nonebot_plugin_learning_chat\config.py", line 77, in init self.config = ChatConfig.parse_obj( File "pydantic\main.py", line 525, in pydantic.main.BaseModel.parse_obj raise ValidationError([ErrorWrapper(exc, loc=ROOT_KEY)], cls) from e pydantic.error_wrappers.ValidationError: 1 validation error for ChatConfig root__ ChatConfig expected dict not NoneType (type=type_error) 此后nb项目将不能运行,我不得不卸载该插件来使得项目可以运行。卸载重装插件也不行,请问如何解决?

CMHopeSunshine commented 9 months ago

检查你的bot所在目录/data/learning_chat/learning_chat.yml文件是否存在或内容是否正常