YouthLearning / TeenStudy

基于nonebot2和OneBot V11协议的青年大学习自动提交插件,用于自动完成最新一期青年大学习,在后台留下记录,返回完成截图
MIT License
100 stars 5 forks source link

完成截图报错:IndexError: list index out of range #3

Closed Agnes4m closed 1 year ago

Agnes4m commented 1 year ago

当前pypi 0.1.3版本,nonebot2.0.0rc3

03-14 13:43:00 [ERROR] nonebot | Running Matcher(type='message', module=TeenStudy.utils.handle) failed.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/usr/lib/python3.9/multiprocessing/spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/dist-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/usr/local/lib/python3.9/dist-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 141, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 187, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher/matcher.py", line 732, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run
    await handler(
  File "/usr/local/lib/python3.9/dist-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/usr/local/lib/python3.9/dist-packages/TeenStudy/utils/handle.py", line 34, in test_
    await end_pic.finish(message=MessageSegment.image(await get_end_pic()))
  File "/usr/local/lib/python3.9/dist-packages/TeenStudy/utils/utils.py", line 194, in get_end_pic
    bg_img = Image.open(BytesIO(backgrouds[random.randint(0, 4)]['file']))
IndexError: list index out of range
ZM25XC commented 1 year ago

资源未导入成功

Agnes4m commented 1 year ago

没办法通过nb或者pip安装直接使用吗

ZM25XC commented 1 year ago

能啊,只是资源数据没导入

meowlitlot commented 1 year ago

没办法通过nb或者pip安装直接使用吗

资源没能导入成功,将utils文件夹下的utils.py文件的第148行base_file_path = os.path.dirname(__file__)[:-5] + "resource\\"中的resource\\改为resource/应该能解决这个问题

ZM25XC commented 1 year ago

已修复,请更新版本至0.1.4