Closed Qianmo2 closed 1 year ago
Windows10系统
2023-03-04 09:17:48.211 | SUCCESS | launart.manager:launch:384 - Layer #1:[cache.client/memcache, http.client/aiohttp] preparation completed. 2023-03-04 09:17:48.289 | SUCCESS | launart.manager:launch:384 - Layer #3:[elizabeth.service] preparation completed. 2023-03-04 09:17:48.289 | INFO | launart.manager:launch:389 - All components prepared, start blocking phase. 2023-03-04 09:17:52.434 | ERROR | utils.text_to_img:text_to_image:359 - I/O operation on closed file Traceback (most recent call last):
File "D:\GPTqq\chatgpt\bot.py", line 291, in
File "D:\GPTqq\chatgpt\python3.9\lib\site-packages\graia\ariadne\app.py", line 312, in launch_blocking cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals) │ │ │ │ │ │ └ (<Signals.SIGINT: 2>,) │ │ │ │ │ └ <property object at 0x00000244B9AEBF40> │ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x000002448E586E20> │ │ │ └ <class 'graia.ariadne.app.Ariadne'> │ │ └ <function Launart.launch_blocking at 0x00000244B7A1FB80> │ └ <launart.manager.Launart object at 0x00000244BD1BDFA0> └ <class 'graia.ariadne.app.Ariadne'>
File "D:\GPTqq\chatgpt\python3.9\lib\site-packages\launart\manager.py", line 494, in launch_blocking
loop.run_until_complete(launch_task)
│ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at D:\GPTqq\chatgpt\python3.9\lib\site-packages\launart\ma...
│ └ <function BaseEventLoop.run_until_complete at 0x0000024490AB31F0>
└
File "asyncio\base_events.py", line 634, in run_until_complete ', '.join(str(exc) for exc in exceptions))) └ <module 'asyncio.exceptions' from 'D:\GPTqq\chatgpt\python3.9\python39.zip\asyncio\exceptions.pyc'>
File "asyncio\windows_events.py", line 321, in run_forever
File "asyncio\base_events.py", line 601, in run_forever exc.errno, 'error while '
File "asyncio\base_events.py", line 1905, in _run_once
File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle <TaskStepMethWrapper object at 0x0000024490ECDBE0>()>
File "D:\GPTqq\chatgpt\python3.9\lib\site-packages\graia\broadcast__init__.py", line 191, in Executor result = await run_always_await(target_callable, **parameter_compile_result) │ │ └ {} │ └ <function start_background at 0x0000024490E6BCA0> └ <function run_always_await at 0x00000244B7A36B80>
File "D:\GPTqq\chatgpt\python3.9\lib\site-packages\graia\broadcast\utilles.py", line 34, in run_always_await obj = await obj └ <coroutine object start_background at 0x0000024490E970C0>
File "D:\GPTqq\chatgpt\bot.py", line 227, in start_background await to_image("$$mc^2$$ test") └ <function to_image at 0x00000244BD11BEE0>
File "D:\GPTqq\chatgpt\utils\text_to_img.py", line 368, in to_image img = await text_to_image(text=text) │ └ '$$mc^2$$ test' └ <function text_to_image at 0x00000244BD11BE50>
File "D:\GPTqq\chatgpt\utils\text_to_img.py", line 333, in text_to_image with StringIO(output_file.getvalue()) as input_file: │ │ └ <method 'getvalue' of '_io.StringIO' objects> │ └ <_io.StringIO object at 0x0000024490E7ACA0> └ <class '_io.StringIO'>
ValueError: I/O operation on closed file 2023-03-04 09:17:52.513 | ERROR | utils.text_to_img:text_to_image:360 - Markdown 渲染失败,使用备用模式
v2.0.1 已修复
提交 issue 前,请先确认:
表现
向bot发送消息后日志中显示Markdown 渲染失败,使用备用模式。
运行环境:
复现步骤
描述你是如何触发这个 BUG 的
截图
chatgpt-qq-chatgpt-1 | app.launch_blocking()
chatgpt-qq-chatgpt-1 | │ └ <classmethod object at 0x7f789190ba30>
chatgpt-qq-chatgpt-1 | └ <graia.ariadne.app.Ariadne object at 0x7f78c340db20>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/site-packages/graia/ariadne/app.py", line 312, in launch_blocking
chatgpt-qq-chatgpt-1 | cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals)
chatgpt-qq-chatgpt-1 | │ │ │ │ │ │ └ (<Signals.SIGINT: 2>,)
chatgpt-qq-chatgpt-1 | │ │ │ │ │ └ <property object at 0x7f789190ef40>
chatgpt-qq-chatgpt-1 | │ │ │ │ └ <graia.ariadne.service.ElizabethService object at 0x7f78c33a5a30>
chatgpt-qq-chatgpt-1 | │ │ │ └ <class 'graia.ariadne.app.Ariadne'>
chatgpt-qq-chatgpt-1 | │ │ └ <function Launart.launch_blocking at 0x7f7892af2b80>
chatgpt-qq-chatgpt-1 | │ └ <launart.manager.Launart object at 0x7f7890bb5970>
chatgpt-qq-chatgpt-1 | └ <class 'graia.ariadne.app.Ariadne'>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/site-packages/launart/manager.py", line 494, in launch_blocking
chatgpt-qq-chatgpt-1 | loop.run_until_complete(launch_task)
chatgpt-qq-chatgpt-1 | │ │ └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at /usr/local/lib/python3.9/site-packages/launart/manager....
chatgpt-qq-chatgpt-1 | │ └ <function BaseEventLoop.run_until_complete at 0x7f78c20d58b0>
chatgpt-qq-chatgpt-1 | └ <_UnixSelectorEventLoop running=True closed=False debug=False>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/asyncio/base_events.py", line 634, in run_until_complete
chatgpt-qq-chatgpt-1 | self.run_forever()
chatgpt-qq-chatgpt-1 | │ └ <function BaseEventLoop.run_forever at 0x7f78c20d5820>
chatgpt-qq-chatgpt-1 | └ <_UnixSelectorEventLoop running=True closed=False debug=False>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/asyncio/base_events.py", line 601, in run_forever
chatgpt-qq-chatgpt-1 | self._run_once()
chatgpt-qq-chatgpt-1 | │ └ <function BaseEventLoop._run_once at 0x7f78c20d93a0>
chatgpt-qq-chatgpt-1 | └ <_UnixSelectorEventLoop running=True closed=False debug=False>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1905, in _run_once
chatgpt-qq-chatgpt-1 | handle._run()
chatgpt-qq-chatgpt-1 | │ └ <function Handle._run at 0x7f78c20f6dc0>
chatgpt-qq-chatgpt-1 | └ <Handle <TaskStepMethWrapper object at 0x7f78900e3f70>()>
chatgpt-qq-chatgpt-1 | File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
chatgpt-qq-chatgpt-1 | self._context.run(self._callback, *self._args)
chatgpt-qq-chatgpt-1 | │ │ │ │ │ └ <member '_args' of 'Handle' objects>
chatgpt-qq-chatgpt-1 | │ │ │ │ └ <Handle <TaskStepMethWrapper object at 0x7f78900e3f70>()>
chatgpt-qq-chatgpt-1 | │ │ │ └ <member '_callback' of 'Handle' objects>
chatgpt-qq-chatgpt-1 | │ │ └ <Handle <TaskStepMethWrapper object at 0x7f78900e3f70>()>
chatgpt-qq-chatgpt-1 | │ └ <member '_context' of 'Handle' objects>
chatgpt-qq-chatgpt-1 | └ <Handle <TaskStepMethWrapper object at 0x7f78900e3f70>()>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | File "/app/bot.py", line 155, in request
chatgpt-qq-chatgpt-1 | async for rendered in task:
chatgpt-qq-chatgpt-1 | │ └ <async_generator object ConversationContext.ask at 0x7f78900df4c0>
chatgpt-qq-chatgpt-1 | └ None
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | File "/app/conversation.py", line 44, in ask
chatgpt-qq-chatgpt-1 | yield await self.renderer.result()
chatgpt-qq-chatgpt-1 | │ │ └ <function MarkdownImageRenderer.result at 0x7f7890cabb80>
chatgpt-qq-chatgpt-1 | │ └ <renderer.renderer.MarkdownImageRenderer object at 0x7f7890241940>
chatgpt-qq-chatgpt-1 | └ <conversation.ConversationContext object at 0x7f7890b60b80>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | File "/app/renderer/renderer.py", line 34, in result
chatgpt-qq-chatgpt-1 | return await to_image(self.msg)
chatgpt-qq-chatgpt-1 | │ │ └ '你好!有什么我可以帮助你的吗?'
chatgpt-qq-chatgpt-1 | │ └ <renderer.renderer.MarkdownImageRenderer object at 0x7f7890241940>
chatgpt-qq-chatgpt-1 | └ <function to_image at 0x7f7890cab790>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | File "/app/utils/text_to_img.py", line 368, in to_image
chatgpt-qq-chatgpt-1 | img = await text_to_image(text=text)
chatgpt-qq-chatgpt-1 | │ └ '你好!有什么我可以帮助你的吗?'
chatgpt-qq-chatgpt-1 | └ <function text_to_image at 0x7f7890cab700>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | > File "/app/utils/text_to_img.py", line 333, in text_to_image
chatgpt-qq-chatgpt-1 | with StringIO(output_file.getvalue()) as input_file:
chatgpt-qq-chatgpt-1 | │ │ └ <method 'getvalue' of '_io.StringIO' objects>
chatgpt-qq-chatgpt-1 | │ └ <_io.StringIO object at 0x7f78900df430>
chatgpt-qq-chatgpt-1 | └ <class '_io.StringIO'>
chatgpt-qq-chatgpt-1 |
chatgpt-qq-chatgpt-1 | ValueError: I/O operation on closed file
chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:12.089 | ERROR | utils.text_to_img:text_to_image:360 - Markdown 渲染失败,使用备用模式
chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:12.203 | DEBUG | middlewares.timeout:handle_respond:44 - [Timeout] 取消计时……
chatgpt-qq-mirai-1 | 2023-03-04 01:00:10 V/Bot.2463724346: Moki.(2657447616) -> 你好 chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:10.199 | INFO | graia.ariadne.model:log:82 - 2463724346: [RECV][Moki.(2657447616)] -> 你好 chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:10.207 | DEBUG | middlewares.timeout:create_timeout_task:14 - [Timeout] 开始计时…… chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:10.209 | DEBUG | adapter.chatgpt.web:preset_ask:86 - [预设] 发送: chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:10.840 | DEBUG | adapter.chatgpt.web:preset_ask:88 - [预设] Chatbot 回应:Hello! How can I assist you today? chatgpt-qq-chatgpt-1 | 2023-03-04 01:00:12.079 | ERROR | utils.text_to_img:text_to_image:359 - I/O operation on closed file chatgpt-qq-chatgpt-1 | Traceback (most recent call last): chatgpt-qq-chatgpt-1 | chatgpt-qq-chatgpt-1 | File "/app/bot.py", line 291, in