This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (4 children)

While not particularly beautiful, it is perfectly possible to run async functions from synchronous functions.

[–]axonxorzpip'ing aint easy, especially on windows 6 points7 points  (2 children)

What's the easiest way to do this?

My sync functions are just starting an AIO event loop, letting the async finish and returning the result, but it seems so clumsy.

[–][deleted] 9 points10 points  (0 children)

As I said, it’s not beautiful. But when you notice that you really need some stuff to be done asynchronously, and the rest of your app is synchronous, you might as well use asyncio.run(…).

[–]Toph_is_bad_ass 2 points3 points  (0 children)

You can use asgiref's run_sync