kitUIN / nonebot_tools

nonebot2 插件工具箱
MIT License
11 stars 5 forks source link

[ERROR] nonebot | Failed to import "nonebot-plugin-ncm"(版本过低,解决方法:升级到a16) #9

Closed lvjiawei1997 closed 2 years ago

lvjiawei1997 commented 2 years ago

部署完后运行不了,请教下是不是缺少了什么东西没装还是什么问题

12-26 18:23:34 [ERROR] nonebot | Failed to import "nonebot-plugin-ncm" Traceback (most recent call last): File "/usr/local/bin/nb", line 8, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/nb_cli/init.py", line 46, in run run_bot(file, app) File "/usr/local/lib/python3.7/dist-packages/nb_cli/handlers.py", line 44, in run_bot module = importlib.import_module(module_name) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "./bot.py", line 23, in nonebot.load_plugins("src/plugins") File "/usr/local/lib/python3.7/dist-packages/nonebot/plugin.py", line 930, in load_plugins result = context.run(_load_plugin, module_info)

File "/usr/local/lib/python3.7/dist-packages/nonebot/plugin.py", line 914, in _load_plugin module = _load(spec) File "", line 696, in _load File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "src/plugins/nonebot-plugin-ncm/init.py", line 9, in from .data_source import Ncm, music, ncm_config, playlist, setting, Q File "src/plugins/nonebot-plugin-ncm/data_source.py", line 27, in music = TinyDB("./db/music.json") File "/usr/local/lib/python3.7/dist-packages/tinydb/database.py", line 94, in init self._storage = storage(*args, **kwargs) # type: Storage File "/usr/local/lib/python3.7/dist-packages/tinydb/storages.py", line 102, in init touch(path, create_dirs=create_dirs) File "/usr/local/lib/python3.7/dist-packages/tinydb/storages.py", line 31, in touch with open(path, 'a'): FileNotFoundError: [Errno 2] No such file or directory: './db/music.json'

kitUIN commented 2 years ago

看起来像是创建默认配置失败 请检查是否与其他程序冲突导致了创建失败

或许您可以在当前目录下的db文件夹里手动创建无内容的music.json

lvjiawei1997 commented 2 years ago

现在能创建了,但是现在用命令bot有回复,但链接和分享没反应

Running matcher <Matcher from nonebot-plugin-ncm, type=message, priority=5, temp=False> failed. Traceback (most recent call last): File "/usr/local/bin/nb", line 8, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke return callback(args, *kwargs) File "/usr/local/lib/python3.7/dist-packages/nb_cli/init.py", line 46, in run run_bot(file, app) File "/usr/local/lib/python3.7/dist-packages/nb_cli/handlers.py", line 52, in run_bot nonebot.run(app=f"{module_name}:{app}") File "/usr/local/lib/python3.7/dist-packages/nonebot/init.py", line 217, in run get_driver().run(host, port, args, kwargs) File "/usr/local/lib/python3.7/dist-packages/nonebot/drivers/fastapi.py", line 124, in run kwargs) File "/usr/local/lib/python3.7/dist-packages/uvicorn/main.py", line 362, in run server.run() File "/usr/local/lib/python3.7/dist-packages/uvicorn/main.py", line 390, in run loop.run_until_complete(self.serve(sockets=sockets))

File "/usr/local/lib/python3.7/dist-packages/nonebot/message.py", line 170, in _run_matcher await matcher.run(bot, event, state) File "/usr/local/lib/python3.7/dist-packages/nonebot/matcher.py", line 496, in run await self.runhandler(handler, bot, event, state) File "/usr/local/lib/python3.7/dist-packages/nonebot/matcher.py", line 482, in run_handler **{k: v for k, v in args.items() if params[k] is not None}) File "src/plugins/nonebot-plugin-ncm/init.py", line 25, in music_receive nid = list(filter(None, state["_matched_groups"])) # 去除None KeyError: '_matched_groups'

kitUIN commented 2 years ago

请问您使用的版本号为:? 1.1.0对应nonebot a16及以下 1.2.0对应nonebot beta1及以上

kitUIN commented 2 years ago

这是你自己的问题吧,端口被占用

lvjiawei1997 commented 2 years ago

是的,我傻了,刚好想起,现在还是发命令有回应,发链接就没回复

运行nb run

01-29 14:44:45 [ERROR] nonebot | Failed to import "nonebot-plugin-ncm" Traceback (most recent call last): File "/usr/local/bin/nb", line 8, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke return callback(args, **kwargs) File "/usr/local/lib/python3.7/dist-packages/nb_cli/init.py", line 46, in run run_bot(file, app) File "/usr/local/lib/python3.7/dist-packages/nb_cli/handlers.py", line 44, in run_bot module = importlib.import_module(module_name) File "/usr/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "./bot.py", line 23, in nonebot.load_plugins("src/plugins") File "/usr/local/lib/python3.7/dist-packages/nonebot/plugin.py", line 930, in load_plugins result = context.run(_load_plugin, module_info)

File "/usr/local/lib/python3.7/dist-packages/nonebot/plugin.py", line 914, in _load_plugin module = _load(spec) File "", line 696, in _load File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "src/plugins/nonebot-plugin-ncm/init.py", line 9, in from nonebot.adapters.onebot.v11 import Bot, MessageSegment, ActionFailed, GroupMessageEvent, PrivateMessageEvent ModuleNotFoundError: No module named 'nonebot.adapters.onebot' 01-29 14:44:45 [INFO] nonebot | Succeeded to import "nonebot_plugin_flashre" ujson module not found, using json msgpack not installed, MsgPackSerializer unavailable

发链接分享时

01-29 14:45:32 [ERROR] nonebot | Running matcher <Matcher from nonebot-plugin-ncm, type=message, priority=5, temp=False> failed. Traceback (most recent call last): File "/usr/local/bin/nb", line 8, in sys.exit(main()) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke return callback(args, *kwargs) File "/usr/local/lib/python3.7/dist-packages/nb_cli/init.py", line 46, in run run_bot(file, app) File "/usr/local/lib/python3.7/dist-packages/nb_cli/handlers.py", line 52, in run_bot nonebot.run(app=f"{module_name}:{app}") File "/usr/local/lib/python3.7/dist-packages/nonebot/init.py", line 217, in run get_driver().run(host, port, args, kwargs) File "/usr/local/lib/python3.7/dist-packages/nonebot/drivers/fastapi.py", line 124, in run kwargs) File "/usr/local/lib/python3.7/dist-packages/uvicorn/main.py", line 362, in run server.run() File "/usr/local/lib/python3.7/dist-packages/uvicorn/main.py", line 390, in run loop.run_until_complete(self.serve(sockets=sockets))

File "/usr/local/lib/python3.7/dist-packages/nonebot/message.py", line 170, in _run_matcher await matcher.run(bot, event, state) File "/usr/local/lib/python3.7/dist-packages/nonebot/matcher.py", line 496, in run await self.runhandler(handler, bot, event, state) File "/usr/local/lib/python3.7/dist-packages/nonebot/matcher.py", line 482, in run_handler **{k: v for k, v in args.items() if params[k] is not None}) File "/usr/local/lib/python3.7/dist-packages/nonebot-plugin-ncm/init.py", line 25, in music_receive nid = list(filter(None, state["_matched_groups"])) # 去除None

kitUIN commented 2 years ago

image 你这些错误真的是.....你都用b版了就不能吧onebot adapter安装下么 image 而且这个代码形式我一看就知道是1.1.0版只支持a版啊