Diving-Fish / mai-bot

Based on nonebot, a common bot framework for maimai.
MIT License
311 stars 90 forks source link

您好我想问一下查询b40报错是怎么回事呢 #35

Closed 964449519 closed 1 year ago

964449519 commented 1 year ago
04-01 14:06:25 [SUCCESS] nonebot | ONEBOT V11 212XXXX335 | [message.group.normal]: Message 2010XX5857 from 964449519@[群:232XX130] "b40"
04-01 14:06:25 [INFO] nonebot | Event will be handled by <Matcher from src.plugins.maimaidx, type=message, priority=1, temp=False>
04-01 14:06:25 [INFO] nonebot | Matcher <Matcher from src.plugins.maimaidx, type=message, priority=1, temp=False> running complete
04-01 14:06:25 [ERROR] nonebot | Running matcher <Matcher from src.plugins.maimaidx, type=message, priority=1, temp=False> failed.
Traceback (most recent call last):
  File "bot.py", line 37, in <module>
    nonebot.run()
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\__init__.py", line 261, in run
    get_driver().run(*args, **kwargs)
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\drivers\fastapi.py", line 180, in run
    **kwargs,
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\uvicorn\main.py", line 576, in run
    server.run()
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 574, in run_until_complete
    self.run_forever()
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 541, in run_forever
    self._run_once()
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 1786, in _run_once
    handle._run()
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\message.py", line 146, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\message.py", line 196, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\internal\matcher.py", line 672, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\internal\matcher.py", line 645, in simple_run
    dependency_cache=dependency_cache,
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\nonebot\dependencies\__init__.py", line 92, in __call__
    return await self.call(**values)
  File "D:\go-cqhttp\mai-bot-main\src\plugins\maimaidx.py", line 278, in _
    img, success = await generate(payload)
  File "D:\go-cqhttp\mai-bot-main\src\libraries\maimai_best_40.py", line 404, in generate
    pic = DrawBest(sd_best, dx_best, obj["nickname"], obj["rating"] + obj["additional_rating"], obj["rating"]).getDir()
  File "D:\go-cqhttp\mai-bot-main\src\libraries\maimai_best_40.py", line 100, in __init__
    self.img = Image.open(self.pic_dir + 'UI_TTR_BG_Base_Plus.png').convert('RGBA')
  File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\site-packages\PIL\Image.py", line 3092, in open
    fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'src/static/mai/pic/UI_TTR_BG_Base_Plus.png'

这个错误好像说是缺少文件,但是我已经按照[EADME.md]的提示下载该项目的压缩包并且部署了 现在不清楚问题出在哪里

RinChanNOWWW commented 1 year ago

看起来就是没找到文件。自行更改下路径吧

https://github.com/Diving-Fish/mai-bot/blob/3f67be3c8fde35a36f8a6d6d15669f7cddf2b9a2/src/libraries/maimai_best_40.py#L98-L99

Diving-Fish commented 1 year ago

在运行代码之前,您需要从此链接下载资源文件并解压到src文件夹中。