rany2 / edge-tts

Use Microsoft Edge's online text-to-speech service from Python WITHOUT needing Microsoft Edge or Windows or an API key
https://pypi.org/project/edge-tts/
GNU General Public License v3.0
6.23k stars 616 forks source link

Simplify asyncio main loop setup #210

Closed zhoukuncheng closed 7 months ago

zhoukuncheng commented 7 months ago

This PR updates the asyncio main loop handling to ensure compatibility with Python 3.7 and newer versions, switching from the outdated loop setup to the more efficient asyncio.run() function.

In Python 3.12, running the example .py files triggers a DeprecationWarning indicating that there is no current event loop.

basic_generation.py:23: DeprecationWarning: There is no current event loop loop = asyncio.get_event_loop_policy().get_event_loop()

rany2 commented 7 months ago

Thanks for your contribution!