Fix support for Python 3.10

Signed-off-by: rany2 <rany2@riseup.net>
This commit is contained in:
rany2
2023-06-02 20:03:37 +03:00
parent 0094e3b952
commit ca6e7b0669
5 changed files with 20 additions and 15 deletions

View File

@@ -20,7 +20,8 @@ VOICE = "en-GB-SoniaNeural"
OUTPUT_FILE = "test.mp3"
async def _main() -> None:
async def amain() -> None:
"""Main function"""
communicate = edge_tts.Communicate(TEXT, VOICE)
with open(OUTPUT_FILE, "wb") as file:
async for chunk in communicate.stream():
@@ -31,8 +32,8 @@ async def _main() -> None:
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop = asyncio.get_event_loop_policy().get_event_loop()
try:
loop.run_until_complete(_main())
loop.run_until_complete(amain())
finally:
loop.close()