How to Call a Async Function From Synchronous Code in Python

preview_player
Показать описание
Having trouble building your Python app? I can help:

💻 Code written in video

Рекомендации по теме
Комментарии
Автор

Love it! I can't tell you how many times I have had issues with this. Thank You Anthony

adamgkruger
Автор

I always like ur videos before even seeing it, as I already know that ur videos are amazing and educational. Thank you for free education.

ritiksahu
Автор

That's pretty neat! I always wondered how to do that.
Great timing, btw; i've been working on getting familiar with asyncio, the last few days.
Thanks, Anthony!

noisytim
Автор

Oh my!!!
Is just simple as it sounds!!! 😆😆😆

shirakawaBa
Автор

I tried to use these steps, but I keep getting the following error: asyncio.run() cannot be called from a running event loop
I do not have any other loop for asyncio running around

mmebella
Автор

What if I have a function that is sync and I don't have access to change it. How do I make it run async? Is that possible? Are Threads the only alternative?

mrek
Автор

I've been searching for quite a while now, and have come across this solution previously, yet when I try it out, I always get the same error. Any help would be appreciated:
RuntimeError: Timeout context manager should be used inside a task

archenjov
Автор

Solution is bad if loop needs to be same for multiple calls. use: asyncio.create_event_loop() and set_event_loop along with loop.run_until_complete to ensure the "loop" is the same.

skewty
Автор

If I use flask, is this better than (flask-)sqlalchemy?

vitandi
Автор

Heyy,

Please make video about
"Flask- pjax"

We are waiting bro .

prathameshpatkar
Автор

this should be used only if you don't have an event loop running.

sinancetinkaya
Автор

You could have stuck with an older non async version ? It's cool asynchronous python is growing in popularity tho

kieran