Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug report: "TypeError: 'coroutine' object is not subscriptable" #168

Closed
lbqc opened this issue Jun 21, 2024 · 1 comment
Closed

bug report: "TypeError: 'coroutine' object is not subscriptable" #168

lbqc opened this issue Jun 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lbqc
Copy link

lbqc commented Jun 21, 2024

Bug Report

TypeError: 'coroutine' object is not subscriptable

Description

When calling AsyncPoeApi.send_message methods with a specified chatId parameter, an error occurs:

TypeError: 'coroutine' object is not subscriptable

The error occurs in the code located at: envs\poe_wrapper39\lib\site-packages\poe_api_wrapper\async_api.py:494:

self.current_thread[bot] = await self.get_chat_history(bot=bot)['data'][bot]

Steps to Reproduce

  1. Call the AsyncPoeApi.send_message method with a specified chatId parameter.
  2. Call the AsyncPoeApi.delete_chat method with a specified chatId parameter.

Resolution

The issue was resolved by modifying the code as follows:

# self.current_thread[bot] = await self.get_chat_history(bot=bot)['data'][bot]
temp = await self.get_chat_history(bot=bot)
self.current_thread[bot] = temp['data'][bot]

and

# chatdata = await self.get_chat_history(bot=bot)['data'][bot]
temp = await self.get_chat_history(bot=bot)
chatdata = temp['data'][bot]

Environment

  • Python Version: 3.9.19
  • pip: 24.0
  • conda: 24.5.0
  • Operating System: windows 11
@snowby666
Copy link
Owner

Thanks for your report. This is resolved.

@snowby666 snowby666 added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants