shiyihang2007 / nonebot-plugin-wordle-simple

A simple plugin of nonebot2 which provides a wordle game.
MIT License
2 stars 0 forks source link

当进行猜词操作时报错 #1

Open Yurchiu opened 3 months ago

Yurchiu commented 3 months ago

日志信息如下:

08-04 14:43:45 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_wordle_simple, lineno=102) failed.
Traceback (most recent call last):
  File "<string>", line 23, in <module>
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\__init__.py", line 335, in run
    get_driver().run(*args, **kwargs)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run
    uvicorn.run(
  File "D:\YurchiuBot\.venv\Lib\site-packages\uvicorn\main.py", line 577, in run
    server.run()
  File "D:\YurchiuBot\.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "D:\Program Files 2\Python\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
  File "D:\Program Files 2\Python\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
  File "D:\Program Files 2\Python\Lib\asyncio\base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "D:\Program Files 2\Python\Lib\asyncio\windows_events.py", line 322, in run_forever
    super().run_forever()
  File "D:\Program Files 2\Python\Lib\asyncio\base_events.py", line 641, in run_forever
    self._run_once()
  File "D:\Program Files 2\Python\Lib\asyncio\base_events.py", line 1987, in _run_once
    handle._run()
  File "D:\Program Files 2\Python\Lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher
    await _run_matcher(
> File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\message.py", line 428, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run
    await handler(
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot_plugin_wordle_simple\__init__.py", line 383, in wordleGuessPlus
    sendImg: str = wordleOutput(historyGuess)
  File "D:\YurchiuBot\.venv\Lib\site-packages\nonebot_plugin_wordle_simple\img.py", line 31, in wordleOutput
    fontStyle = ImageFont.truetype(
  File "D:\YurchiuBot\.venv\Lib\site-packages\PIL\ImageFont.py", line 834, in truetype
    return freetype(font)
  File "D:\YurchiuBot\.venv\Lib\site-packages\PIL\ImageFont.py", line 831, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "D:\YurchiuBot\.venv\Lib\site-packages\PIL\ImageFont.py", line 257, in __init__
    self.font = core.getfont(
OSError: cannot open resource

进行 /wordle.guess 某个单词 时报错,机器人无任何输出。当再次猜此单词时,无报错,机器人表示已经猜过此单词。

Yurchiu commented 3 months ago

文件路径问题,尝试改为绝对路径成功