bug report: "TypeError: 'coroutine' object is not subscriptable"
Closed this issue · 1 comments
lbqc commented
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
- Call the
AsyncPoeApi.send_message
method with a specifiedchatId
parameter. - Call the
AsyncPoeApi.delete_chat
method with a specifiedchatId
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 commented
Thanks for your report. This is resolved.