Re: Make synchronous generator from an asynchronous generator

2018-03-16 Thread Julien Salort
Le 16/03/2018 à 16:55, Ian Kelly a écrit : Note that this function can't be called more than once, because it closes the event loop at the end. Next time you call it it will get the closed event loop and try to schedule on it and then raise an exception because it's closed. Ah ok. So, if I repl

Re: Make synchronous generator from an asynchronous generator

2018-03-16 Thread Ian Kelly
On Thu, Mar 15, 2018 at 1:35 PM, Julien Salort wrote: > Because I wanted to keep the synchronous function for scripts which used it, > without unnecessarily duplicating the code, I built also a synchronous > function from this new asynchronous one, like that: > > def acquire_to_files(self, *args

Make synchronous generator from an asynchronous generator

2018-03-16 Thread Julien Salort
Hello, I have recently got the need to convert a synchronous function to asynchronous function because I needed to run three of them concurrently. Since I am using Python 3.6, I used async def and asyncio and that has worked out great. Thank you guys for making this possible. Because I want