python3.5中收集的异步\u生成器垃圾

2024-09-28 22:43:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用telethon库处理电报客户机。当我在消息上获得迭代器时,在从聊天室读取所有消息(即,读取历史记录已完成)后,我会得到以下错误:

Exception ignored in: <bound method AsyncGenerator.__del__ of <async_generator._impl.AsyncGenerator object at 0x7f2cbdc54f60>>

Traceback (most recent call last):

File "/home/ahmad/PycharmProjects/thelethontest/venv/lib/python3.5/site-packages/async_generator/_impl.py", line 324, in __del__
.format(self._coroutine.cr_frame.f_code.co_name)

RuntimeError: partially-exhausted async_generator 'iter_messages' garbage collected

为什么会出现这个错误,如何解决?你知道吗


我知道在for循环中使用break时会出现这个错误。我需要在某种情况下打破循环。我需要一个解决方案来打破循环而不出错。你知道吗


Tags: in消息历史记录async客户机错误exception电报