Asyncio.run Not Supported
See original GitHub issueI tried to use the Python 3.7 approach for asyncio via asyncio.run() and not loop.run_until_complete(). This produces the following error:
RuntimeError: Task <Task pending coro=<query_elasticsearch() running at <ipython-input-10-b627b3d0f9d9>:23> cb=[as_completed.<locals>._on_completion() at /miniconda3.7/lib/python3.7/asyncio/tasks.py:520]> got Future <Task pending coro=<AsyncTransport.main_loop() running at /lib/python3.7/site-packages/elasticsearch_async/transport.py:143>> attached to a different loop
If this is not a bug but just not supported yet, is there plans to include this? Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (2 by maintainers)
Top Results From Across the Web
"asyncio.run() cannot be called from a running event loop ...
The asyncio.run() documentation says: This function cannot be called when another asyncio event loop is running in the same thread.
Read more >Developing with asyncio — Python 3.11.1 documentation
Asynchronous programming is different from classic “sequential” programming. This page lists common mistakes and traps and explains how to avoid them.
Read more >Asyncio is not supported for python console with python 3.8
Setup Python 3.8 interpreter · Go to File | Settings | Build, Execution, Deployment | Console | Python Console and add to the...
Read more >Python Asyncio Part 5 – Mixing Synchronous and ...
You can't run async code unless you have an event loop to run it in (without implementing some special work-around involving an object...
Read more >Python Asyncio: The Complete Guide
Error 1: Trying to Run Coroutines by Calling Them; Error 2: Not Letting ... Next, let's consider asynchronous programming support in Python.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey all! I’m going to be doing an overhaul of the
elasticsearch-async
package to add async/await (instead of usingyield from
) while updating the API to 7.x. That’s a big chunk of work so won’t be coming “soon” but is something that’s on the radar.asyncio.run()
is supported byelasticsearch[async]
without requiring the client to be defined inside the event loop.