We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f981a5f commit 011f97cCopy full SHA for 011f97c
testing/install_pyodide_libs.py
@@ -71,10 +71,10 @@ async def main():
71
72
73
if __name__ == '__main__':
74
- try:
75
- # Check if running inside an existing event loop
76
- loop = asyncio.get_running_loop()
77
- asyncio.ensure_future(main())
78
- except RuntimeError:
79
- # No running event loop, safe to use asyncio.run()
+ if asyncio.get_event_loop().is_running():
+ # If an event loop is already running, use create_task()
+ task = asyncio.create_task(main())
+ asyncio.get_event_loop().run_until_complete(task)
+ else:
+ # If no event loop is running, use asyncio.run()
80
asyncio.run(main())
0 commit comments