Skip to content

Commit 9a594d3

Browse files
committed
handle exception
1 parent 56c2728 commit 9a594d3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

testing/install_pyodide_libs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
PY_FILES_DIR = os.path.join(PARENT_DIR, 'py_files')
1212
SKIP_FILES = [
1313
'short_path.py',
14-
'inflation_history.py'
14+
'inflation_history.py',
1515
]
1616

1717
def get_imported_libraries(file_path):
@@ -68,4 +68,10 @@ async def main():
6868

6969

7070
if __name__ == '__main__':
71-
asyncio.run(main())
71+
try:
72+
# Check if running inside an existing event loop
73+
loop = asyncio.get_running_loop()
74+
asyncio.ensure_future(main())
75+
except RuntimeError:
76+
# No running event loop, safe to use asyncio.run()
77+
asyncio.run(main())

0 commit comments

Comments
 (0)