Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· openaiHugging Face Suzhen/CodeChat

RuntimeWarning: coroutine 'FSMContext.setstate' was never awaited state.setstate(None)…

  1. User

    RuntimeWarning: coroutine 'FSMContext.set_state' was never awaited state.set_state(None) RuntimeWarning: Enable tracemalloc to get the object allocation traceback

  2. Assistant

    This is a warning message indicating that the asyncio coroutine 'set_state' was not awaited properly. The coroutine is part of the FSMContext class which is used for implementing Finite State Machines in Python.

    To resolve this warning, the coroutine should be awaited properly, either by using the 'await' keyword or by wrapping the coroutine in the asyncio.ensure_future method.

    Here is an example of how to properly await the 'set_state' coroutine:

    async def my_function(state):
        await state.set_state(None)
    

    Alternatively, you can use the 'ensure_future' method:

    async def my_function(state):
        asyncio.ensure_future(state.set_state(None))