iT邦幫忙

0

有關DiscordBot的AttributeError: __aexit__問題

  • 分享至 

  • xImage

想請問一下大家,這是我在replit上運行的,當更新完pip之後可能是因為套件還是python不相容的問題突然就出現以下錯誤訊息:
謝謝大家的解答~~

Traceback (most recent call last):
  File "main.py", line 101, in <module>
    asyncio.run(main())
  File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/nix/store/p21fdyxqb3yqflpim7g8s1mymgpnqiv7-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "main.py", line 94, in main
    async with bot:
AttributeError: __aexit__
  * Running on all addresses (0.0.0.0)
   WARNING: This is a development server. Do not use it in a production deployment.

原代碼為這樣:

async def main():
    async with bot:
        await load_extensions()
        await bot.start(os.environ['Token'])

# 確定執行此py檔才會執行
if __name__ == "__main__":
    keep_alive.keep_alive()
    asyncio.run(main())
code840 iT邦新手 5 級 ‧ 2023-08-02 08:51:48 檢舉
async with 要 discord.py 2.0 以上才支援
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答