noneplugin / nonebot-plugin-memes

Nonebot2 表情包制作插件
MIT License
224 stars 20 forks source link

加载时报错 #51

Closed hakureireimusama closed 1 year ago

hakureireimusama commented 1 year ago

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))

File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\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 "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "C:\Users\hakurei\AppData\Local\Programs\Python\Python310\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:\Users\hakurei\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_memes__init__.py", line 8, in from meme_generator.exception import ( ModuleNotFoundError: No module named 'meme_generator.exception'

MeetWq commented 1 year ago

你的插件是怎样安装的?

hakureireimusama commented 1 year ago

nb plugin install nonebot-plugin-memes

hakureireimusama commented 1 year ago

用这条命令安装的

MeetWq commented 1 year ago

看一下 nonebot2 和 nb-cli 版本

hakureireimusama commented 1 year ago

nb-cli 1.1.2

hakureireimusama commented 1 year ago

nonebot2 2.0.0rc4

hakureireimusama commented 1 year ago

Python 3.10.11

MeetWq commented 1 year ago

你是用 nb-cli 创建的项目吗?怎么没有虚拟环境

hakureireimusama commented 1 year ago

之前创建的有虚拟环境的也报错,就试试看没有虚拟环境的情况会不会报错,发现也会报错

hakureireimusama commented 1 year ago

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 "", line 14, in File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\load.py", line 125, in load_from_toml return load_all_plugins(plugins, plugin_dirs) File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\load.py", line 62, in load_all_plugins return manager.load_all_plugins() File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\manager.py", line 175, in load_all_plugins return set( File "C:\bot\nb2.venv\lib\site-packages\nonebot\plugin\manager.py", line 176, in filter(None, (self.load_plugin(name) for name in self.available_plugins))

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 "", 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.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)

这是有虚拟环境的情况,也会报错

MeetWq commented 1 year ago

你的memes_disabled_list 配置项格式不对

hakureireimusama commented 1 year ago

原来如此,本人完全不懂python,想全局禁用“关注”这个表情 memes_disabled_list = [follow] 我是这样写的,应该这么写才符合规范呀~

MeetWq commented 1 year ago

加引号,如 ["follow"]

hakureireimusama commented 1 year ago

好耶,终于不报错了~