### Issue type Bug ### How did you install PythonMonkey? None ### OS platform and distribution Windows 11 x64 ### Python version (`python --version`) 3.13.0 ### PythonMonkey version (`pip show pythonmonkey`) 1.3.1 ### Bug Description When awaiting a JavaScript async function from Python using `asyncio.run()`, PythonMonkey raises: ```shell RuntimeError: PythonMonkey cannot find a running Python event-loop to make asynchronous calls. ``` However, a Python event loop is clearly running and can be retrieved with: print(asyncio.get_running_loop()) which outputs: ```shell <ProactorEventLoop running=True closed=False debug=False> ``` This suggests that PythonMonkey is unable to access the currently running event loop internally, even though one exists. ### Standalone code to reproduce the issue ```shell import asyncio import pythonmonkey as pm async def async_fn(): print(asyncio.get_running_loop()) await pm.eval(""" new Promise((resolve) => setTimeout((...args) => { console.log(args); resolve(); }, 1000, 42, "abc") ) """) await pm.eval("async (x) => await x")(asyncio.sleep(0.5)) asyncio.run(async_fn()) ``` ### Relevant log output or backtrace ```shell await pm.eval(""" ~~~~~~~^^^^ new Promise((resolve) => setTimeout((...args) => { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... ) ^ """) ^^^^ RuntimeError: PythonMonkey cannot find a running Python event-loop to make asynchronous calls ``` ### Additional info if applicable ```shell ``` ### What branch of PythonMonkey were you developing on? (If applicable) _No response_
Activity
wiwichips commentedon May 28, 2026
I assume changing it to the following would make it work?
lmk if I'm wrong, I didn't test it...
LetuGitHub commentedon May 29, 2026
Thanks. I tested the snippet you provided, but I still get the same error.
wiwichips commentedon May 29, 2026
FWIW - I can't reproduce this issue with python 3.12.8 and pm 1.3.1 on macos
Will try 3.13 on windows later...
LetuGitHub commentedon May 30, 2026
Thanks for looking into this. I'm currently waiting for the Windows test results. Please let me know what you find.
LetuGitHub commentedon May 30, 2026
After switching to Python 3.13.13, the issue disappeared and it now returns the results correctly.