Thank you for the library!
I tried a simple generation example code in Pythonista and it works but only once. On the second run it returns an error “Event loop is closed”.
The code I tryed:
import asyncio
import edge_tts as et
def et_save_to_file(text, *, voice="en-GB-SoniaNeural", file="test.mp3"):
async def wrapper():
c = et.Communicate(text, voice)
await c.save(file)
loop = asyncio.get_event_loop_policy().get_event_loop()
try:
loop.run_until_complete(wrapper())
finally:
loop.close()
if __name__ == "__main__":
et_save_to_file("Hey, this is a test!")
The error I got on the second run:
sys:1: RuntimeWarning: coroutine 'et_save_to_file.<locals>.wrapper' was never awaited
Thank you for the library! I tried a simple generation example code in Pythonista and it works but only once. On the second run it returns an error “Event loop is closed”. The code I tryed:
The error I got on the second run:
Is there any way to avoid asyncio totally?