【问题标题】:discord.py: RuntimeWarning: Enable tracemalloc to get the object allocation tracebackdiscord.py: RuntimeWarning: E​​nable tracemalloc to get the object allocation traceback
【发布时间】:2022-11-21 01:18:51
【问题描述】:
for filename in os.listdir("./cogs"):
if filename.endswith('.py'):
    Bot.load_extension(f'cogs.{filename[:-3]}')
Bot.run(TOKEN)

错误: main.py:259: RuntimeWarning: 从未等待协程 'BotBase.load_extension' Bot.load_extension(f'cogs.{filename[:-3]}') RuntimeWarning:启用 tracemalloc 以获取对象分配回溯

【问题讨论】:

    标签: python discord.py bots


    【解决方案1】:

    阅读错误。它说你不是在等待协程,如果你查看你的代码,你确实不是在等待它。

    从未等待协程“BotBase.load_extension”

    迁移指南解释了如何在 2.0 中加载扩展:https://discordpy.readthedocs.io/en/stable/migrating.html#extension-and-cog-loading-unloading-is-now-asynchronous

    【讨论】:

      猜你喜欢
      • 2021-11-24
      • 2022-12-02
      • 2022-12-01
      • 2022-12-19
      • 2022-12-27
      • 2022-12-01
      • 2013-01-09
      • 2022-12-27
      • 2012-09-28
      相关资源
      最近更新 更多