'What happens to error output in asyncio coroutine

def asyncloop(loop):
    # Set loop as the active event loop for this thread
    asyncio.set_event_loop(loop)
    # We will get our tasks from the main thread so just run an empty loop
    loop.run_forever()

loop = asyncio.new_event_loop()
t = threading.Thread(target=asyncloop, args=(loop,))
t.start()
asyncio.run_coroutine_threadsafe(async_main(url, cp, window), loop)

This is how I initialize my coroutine. It has in separate thread due some requirements of the GUI environment.

If I print something in the coroutine, the text gets printed in the output.

When an error happens in the coroutine, nothing is printed. What happens to stderr in such case. Can I somehow log the error from the coroutine?

Running something in a separate thread without async does not have these problems.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source